Exemplo n.º 1
0
        public void MakeRelativePathRelativeToProject()
        {
            string relTestPath = "Assets/Foo/Bar";
            string rel         = ProjectUtil.MakePathRelativeToProject(relTestPath);

            Assert.AreEqual(relTestPath, rel);
        }
Exemplo n.º 2
0
        public static void CallCargoProcess(Func <string, Process> cargoFunc, string taskName, bool printBuildOutput = true, Action <int> exitCodeCallBack = null)
        {
            if (printBuildOutput)
            {
                ProjectUtil.GetBuildWindowPane().Clear();
                ProjectUtil.PrintToBuild(String.Format("------------------------- Cargo {0} -------------------------\n", taskName));
                ProjectUtil.PrintToBuild(taskName.ToUpper(), String.Format("Starting {0} ...", taskName));
            }

            // Get working dir via selected rust project node
            RustProjectNode rustProj = ProjectUtil.GetActiveRustProject();

            // Call the cargo function with current working directory as argument
            Tuple <Process, Exception> process = CommonUtil.TryCatch(() => cargoFunc(rustProj.BaseURI.AbsoluteUrl));

            if (process.Item2 != null)   // Exception
            {
                HandleProcessStartException(process, printBuildOutput);
            }
            else if (process.Item1 != null) // No exception, process is there
            {
                HandleProcess(taskName, rustProj, process, printBuildOutput, exitCodeCallBack);
            }

            if (printBuildOutput)
            {
                ProjectUtil.PrintToBuild("-------------------------------------------------------------\n\n");
            }
        }
Exemplo n.º 3
0
        public JsonResult GetFriendCallDetailsPrep([DataSourceRequest] DataSourceRequest request, int dateIndex, string friendFbId)
        {
            IList <DateTime> dateRange = CallDetailsModel.GetDateRange();
            string           startDate = String.Format("{0:dd'/'MM'/'yyyy}", dateRange[dateIndex + 1]);
            string           endDate   = String.Format("{0:dd'/'MM'/'yyyy}", dateRange[dateIndex]);

            ServiceManager.ServiceHandlers.CallDetailHandler srvHandler = new CallDetailHandler();

            var srvData = srvHandler.PrepareData(startDate, endDate);

            IList <CallDetailModel> modelList = (from u in srvData
                                                 join p in UserFb.Friends on LIB.StringHelper.Right(u.OpAddress.TrimEnd(), 10) equals p.Msisdn
                                                 into a
                                                 from f in a.DefaultIfEmpty(new UserFbFriendModel())
                                                 select new CallDetailModel
            {
                Amount = u.Amount,
                DataVolume = u.DataVolume,
                DateDisplay = u.DateDisplay,
                Description = u.Description,
                OpAddress = ProjectUtil.CallDetailOpAddres(u.OpAddress, session.IsSubscriptionActive),
                PictureLink = f.PictureLink,
                UserId = f.UserId,
                FbId = f.FbId,
                FirstNameView = f.FirstNameView,
                IsClickToCallBlock = f.IsClickToCallBlock,
                IsClickToCallInvisible = f.IsClickToCallInvisible,
                LastNameView = f.LastNameView,
            })
                                                .Where(f => f.FbId == friendFbId)
                                                .ToList();

            return(Json(modelList.ToList(), JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
        protected void LoadMoreProjects(object sender, EventArgs e)
        {
            User user = (User)Session["User"];

            ViewState["count"] = Convert.ToInt32(ViewState["count"]) + 1;
            int loaded = Convert.ToInt32(ViewState["count"]);

            List <Project> projects = ProjectUtil.GetProjects();

            if (loaded == 1)
            {
                ViewState["count"] = Convert.ToInt32(ViewState["count"]) + 1;
                loaded             = Convert.ToInt32(ViewState["count"]);
            }
            for (int i = 10; i < loaded * 10 && i < projects.Count; i++)
            {
                if (user.RoleId > 1)
                {
                    MakeAdminText(projects, projectNode, i);
                }
                else
                {
                    MakeText(projects, projectNode, i);
                }
            }

            numberShowing.InnerHtml = "";
            var showing = "Showing 1 - " + count + " of " + projects.Count + " Results";

            numberShowing.InnerHtml += showing;
        }
 public void OnDrop(PointerEventData eventData)
 {
     if (eventData.pointerDrag != null)
     {
         if (!eventData.pointerDrag.GetComponent <Image>().sprite.Equals(defaultSprite))
         {
             InventoryBoxManager otherBox = eventData.pointerDrag.GetComponentInParent <InventoryBoxManager>();
             if (owner == InventoryOwner.Player && otherBox.owner == InventoryOwner.Player)
             {
                 if (InventoryToolbox.instance.GetGlobalComponent(owner).Swap(slotID, otherBox.GetID()))
                 {
                     Sprite temp = iconSpot.sprite;
                     UpdateIcon(eventData.pointerDrag.GetComponent <Image>().sprite);
                     eventData.pointerDrag.GetComponentInParent <InventoryBoxManager>().UpdateIcon(temp);
                     //eventData.pointerDrag.GetComponent<Image>().sprite = temp;
                 }
             }
             if ((owner == InventoryOwner.Blacksmith && otherBox.owner == InventoryOwner.Player) || (owner == InventoryOwner.Player && otherBox.owner == InventoryOwner.Blacksmith))
             {
                 if (ProjectUtil.Sell(InventoryToolbox.instance.GetGlobalComponent(otherBox.owner), otherBox.GetID(), InventoryToolbox.instance.GetGlobalComponent(owner), slotID))
                 {
                     Sprite temp = iconSpot.sprite;
                     UpdateIcon(eventData.pointerDrag.GetComponent <Image>().sprite);
                     eventData.pointerDrag.GetComponentInParent <InventoryBoxManager>().UpdateIcon(temp);
                 }
             }
         }
     }
 }
Exemplo n.º 6
0
        protected static ElementProperties ReadFromXml(XmlElement parent, ISolution solution, string nameAttribute)
        {
            int rangeStart;
            int rangeEnd;
            var fileName  = parent.GetAttribute(FileNameAttribute);
            var name      = parent.GetAttribute(nameAttribute);
            var id        = parent.GetAttribute(ProjectAttribute);
            var textRange = (!int.TryParse(parent.GetAttribute(TextRangeStartAttribute), out rangeStart) ||
                             !int.TryParse(parent.GetAttribute(TextRangeEndAttribute), out rangeEnd))
                                ? TextRange.InvalidRange
                                : new TextRange(rangeStart, rangeEnd);
            var projectFolder = (IProject)ProjectUtil.FindProjectElementByPersistentID(solution, id);

            var referencedFiles = (from element in parent.ChildNodes.OfType <XmlElement>()
                                   where Equals(element.Name, ReferencedFileTag)
                                   select element.GetAttribute(ReferencedFilePathAttribute)).ToList();

            var file = projectFolder.GetAllProjectFiles(f => Equals(f.Location.FullPath, fileName)).FirstOrDefault();

            if (file == null)
            {
                return(null);
            }

            return(new ElementProperties
            {
                Name = name,
                FileName = fileName,
                ProjectFolder = projectFolder,
                ProjectFileEnvoy = ProjectModelElementEnvoy.Create(file),
                TextRange = textRange,
                ReferencedFiles = referencedFiles
            });
        }
        public static IUnitTestElement ReadFromXml(XmlElement parent, IUnitTestElement parentElement, MSpecUnitTestProvider provider, ISolution solution
#if RESHARPER_61
                                                   , IUnitTestElementManager manager, PsiModuleManager psiModuleManager, CacheManager cacheManager
#endif
                                                   )
        {
            var projectId = parent.GetAttribute("projectId");
            var project   = ProjectUtil.FindProjectElementByPersistentID(solution, projectId) as IProject;

            if (project == null)
            {
                return(null);
            }

            var behavior = parentElement as BehaviorElement;

            if (behavior == null)
            {
                return(null);
            }

            var typeName   = parent.GetAttribute("typeName");
            var methodName = parent.GetAttribute("methodName");
            var isIgnored  = bool.Parse(parent.GetAttribute("isIgnored"));

            return(BehaviorSpecificationFactory.GetOrCreateBehaviorSpecification(provider,
#if RESHARPER_61
                                                                                 manager, psiModuleManager, cacheManager,
#endif
                                                                                 project, behavior, ProjectModelElementEnvoy.Create(project), typeName, methodName, isIgnored));
        }
        internal static IUnitTestElement ReadFromXml(XmlElement parent, IUnitTestElement parentElement, ISolution solution, UnitTestElementFactory unitTestElementFactory)
        {
            var testClass = parentElement as XunitTestClassElement;

            if (testClass == null)
            {
                throw new InvalidOperationException("parentElement should be xUnit.net test class");
            }

            var typeName   = parent.GetAttribute("typeName");
            var methodName = parent.GetAttribute("methodName");
            var projectId  = parent.GetAttribute("projectId");
            var skipReason = parent.GetAttribute("skipReason");
            var isDynamic  = parent.GetAttribute("dynamic", false);

            var project = (IProject)ProjectUtil.FindProjectElementByPersistentID(solution, projectId);

            if (project == null)
            {
                return(null);
            }

            // TODO: Save and load traits. Not sure it's really necessary, they get updated when the file is scanned
            return(unitTestElementFactory.GetOrCreateTestMethod(project, testClass,
                                                                new ClrTypeName(typeName), methodName, skipReason, new MultiValueDictionary <string, string>(), isDynamic));
        }
Exemplo n.º 9
0
        protected void ParseECDefine()
        {
            var path = AppDomain.CurrentDomain.BaseDirectory;

            Console.WriteLine(path);
            Dictionary <string, Type[]> dllPath2Types = new Dictionary <string, Type[]>();

            ProjectUtil.Log("ParseECDefine ");

            PathUtil.Walk(path, "*.dll", (filePath) => {
                if (filePath.Contains(Info.DllNameTag) && !filePath.Contains(Info.IgnoreDll))
                {
                    ProjectUtil.Log("DllPath " + filePath);
                    var types  = DllUtil.LoadDll(filePath, (t) => true);
                    types      = types.Where(t => t.Namespace.Contains(Info.TypeNameSpaceTag)).ToArray();
                    var geners = GetType().Assembly.GetTypes()
                                 .Where(t => t.BaseType != null && typeof(CodeGenBase).IsAssignableFrom(t) && t != typeof(CodeGenBase));
                    foreach (var gener in geners)
                    {
                        StringBuilder sb = new StringBuilder();
                        var instance     = (CodeGenBase)Activator.CreateInstance(gener);
                        instance._sb     = sb;
                        instance.Info    = Info;
                        instance.GenCode(types);
                        var outputPath = Path.Combine(Path.Combine(path, Info.DesFileDir), gener.Name.Replace("CodeGen", "UnsafeECSGen_") + ".cs");
                        SaveToFile(outputPath, sb);
                    }
                }
            });
        }
Exemplo n.º 10
0
    public int Add(Item item, int amount)
    {
        if (itemList == null || itemList.Length != size)
        {
            Setup();
        }
        int openSpot = -1;

        Debug.Log("itemList[].Length: " + itemList.Length + " size: " + size);
        for (int x = 0; x < size; x++)
        {
            if (itemList[x].occupied)
            {
                if (ProjectUtil.ItemsEqual(item, itemList[x].item, database))
                {
                    itemList[x].quantity += amount;
                    return(x);
                }
            }
            if (openSpot == -1 && itemList[x].item == null)
            {
                openSpot = x;
            }
        }
        if (openSpot != -1)
        {
            itemList[openSpot]          = new InventoryInfo(item, amount);
            itemList[openSpot].occupied = true;
            return(openSpot);
        }
        return(-1);
    }
Exemplo n.º 11
0
        private void CreateAdminGraph(List <Project> projects)
        {
            List <Project> allProjects = ProjectUtil.GetProjects();
            int            closed      = 0;
            int            open        = 0;
            int            hold        = 0;

            foreach (Project proj in allProjects)
            {
                if (proj.StatusId == 3)
                {
                    closed++;
                }
                if (proj.StatusId == 4)
                {
                    hold++;
                }
                if (proj.StatusId == 0 || proj.StatusId == 1)
                {
                    open++;
                }
            }
            var graphScript = "<canvas id=\"pie-chart\" width=\"800\" height=\"250\"></canvas>";

            graphScript += "<script>new Chart(document.getElementById(\"pie-chart\"), {type:'pie', data:{labels: [";
            graphScript += "\"Open\", \"Closed\", \"On Hold\"],";
            graphScript += "datasets: [{label: \"Total\", backgroundColor: [\"#dc7a32\", \"#04828F\", \"#5C3315\", \"#32CBDC\"],";
            graphScript += "data: [" + open + ", " + closed + ", " + hold + "]}]}, options:{title:{display:true,text:'All Projects: " + projects.Count + "', position: 'bottom'}}});</script>";

            piechart.InnerHtml += graphScript;
        }
Exemplo n.º 12
0
        private IEnumerable <Completion> GetCompletions(string[] lines)
        {
            var matches = lines.Where(l => l.StartsWith("MATCH")).Distinct(StringComparer.Ordinal);

            foreach (var matchLine in matches)
            {
                var tokens                = matchLine.Substring(6).Split(',');
                var text                  = tokens[0];
                var langElemText          = tokens[4];
                var descriptionStartIndex = tokens[0].Length + tokens[1].Length + tokens[2].Length + tokens[3].Length + tokens[4].Length + 11;
                var description           = matchLine.Substring(descriptionStartIndex);
                CompletableLanguageElement elType;

                if (!Enum.TryParse(langElemText, out elType))
                {
                    ProjectUtil.DebugPrintToOutput("Failed to parse language element found in racer autocomplete response: {0}", langElemText);
                    continue;
                }

                var insertionText = text;
                var icon          = GetCompletionIcon(elType);

                yield return(new Completion(text, insertionText, description, icon, ""));
            }
        }
Exemplo n.º 13
0
        static void HandleProcess(
            string taskName, RustProjectNode rustProj, Tuple <Process, Exception> process, bool printBuildOutput = true, Action <int> exitCodeCallBack = null)
        {
            if (printBuildOutput)
            {
                ProjectUtil.PrintToBuild(taskName.ToUpper(), "Started at " + process.Item1.StartTime.ToLongTimeString());
            }

            // Start redirecting the set Outputs of the process to the build pane
            // Wait for all to complete, then print finish message and check for exceptions
            WaitAllNotNull(RedirectOutputsIfNeeded(taskName, rustProj, process.Item1, printBuildOutput))
            .ContinueWith(
                task =>
            {
                if (task.Exception != null && printBuildOutput)
                {
                    ProjectUtil.ShowExceptionDialog(task.Exception);
                }

                // Be sure process is finshed, is needed!
                // Outputs can be closed but process is still running,
                // then ExitTime throws an exception
                process.Item1.WaitForExit();

                exitCodeCallBack.Call(process.Item1.ExitCode);

                if (printBuildOutput)
                {
                    ProjectUtil.PrintToBuild(
                        taskName,
                        "Finished at " + DateTime.Now.ToLongTimeString());
                }
            });
        }
Exemplo n.º 14
0
        public void MakeRelativePathRelativeToAssets()
        {
            string relTestPath = "Assets/Foo/Bar";
            string rel         = ProjectUtil.MakePathRelativeToAssets(relTestPath);

            Assert.AreEqual(Path.Combine("Foo", "Bar"), rel);
        }
Exemplo n.º 15
0
        public static IUnitTestElement ReadFromXml(XmlElement parent,
                                                   IUnitTestElement parentElement,
                                                   ISolution solution,
                                                   BehaviorSpecificationFactory factory)
        {
            var projectId = parent.GetAttribute("projectId");
            var project   = ProjectUtil.FindProjectElementByPersistentID(solution, projectId) as IProject;

            if (project == null)
            {
                return(null);
            }

            var behavior = parentElement as BehaviorElement;

            if (behavior == null)
            {
                return(null);
            }

            var typeName   = parent.GetAttribute("typeName");
            var methodName = parent.GetAttribute("methodName");
            var isIgnored  = bool.Parse(parent.GetAttribute("isIgnored"));

            return(factory.GetOrCreateBehaviorSpecification(behavior,
                                                            new ClrTypeName(typeName),
                                                            methodName,
                                                            isIgnored));
        }
Exemplo n.º 16
0
        public void MakeRelativeExternalPathPRelativeToProject()
        {
            string path = "../../foo foo";
            string rel  = ProjectUtil.MakePathRelativeToProject(path);

            Assert.AreEqual(rel, path);
        }
Exemplo n.º 17
0
        protected void DenyFormBtn_Click(object sender, EventArgs e)
        {
            FormResult.Visible = false;
            //updating a form not, creating it
            if (Request.QueryString["pfid"] != null)
            {
                string  denyText = DenyReason.Text;
                int     formId   = int.Parse(Request.QueryString["pfid"]);
                Form    f        = FormUtil.GetForm(formId);
                Project p        = ProjectUtil.GetProject(f.ProjectId);

                User user = (User)Session["User"];
                FormUtil.DenyForm(formId, denyText, user.RoleId);
                FormResult.CssClass = "success";
                FormResult.Text     = "Denied form " + f.FormName;
                if (denyText.Length > 0)
                {
                    FormResult.Text += ": " + denyText;
                }
                else
                {
                    denyText = "None specified";
                }
                Log.Info(user.Identity + " denied " + CompanyUtil.GetCompanyName(p.CompanyId) + "'s form " + f.FormName + " - " + p.Name + " with reason: " + denyText);
                Response.Redirect("Forms.aspx?pfid=" + formId);
                FormResult.Visible = true;
            }
        }
        public static IUnitTestElement ReadFromXml(XmlElement parent, IUnitTestElement parentElement, MSpecUnitTestProvider provider, ISolution solution
#if RESHARPER_61
                                                   , IUnitTestElementManager manager, PsiModuleManager psiModuleManager, CacheManager cacheManager
#endif
                                                   )
        {
            var projectId = parent.GetAttribute("projectId");
            var project   = ProjectUtil.FindProjectElementByPersistentID(solution, projectId) as IProject;

            if (project == null)
            {
                return(null);
            }

            var typeName         = parent.GetAttribute("typeName");
            var assemblyLocation = parent.GetAttribute("assemblyLocation");
            var isIgnored        = bool.Parse(parent.GetAttribute("isIgnored"));
            var subject          = parent.GetAttribute("subject");

            return(ContextFactory.GetOrCreateContextElement(provider,
#if RESHARPER_61
                                                            manager, psiModuleManager, cacheManager,
#endif
                                                            project,
                                                            ProjectModelElementEnvoy.Create(project),
                                                            typeName,
                                                            assemblyLocation,
                                                            subject,
                                                            EmptyArray <string> .Instance,
                                                            isIgnored));
        }
Exemplo n.º 19
0
        public JsonResult GetFriendCallDetailsPosp([DataSourceRequest] DataSourceRequest request, string Period, string friendFbId)
        {
            ServiceManager.ServiceHandlers.CallDetailHandler srvHandler = new CallDetailHandler();
            srvHandler.customerType = (Parameter.CustomerType)UserFb.Data.CustomerType;

            var srvData = srvHandler.PrepareData(Period);

            IList <CallDetailModel> modelList = (from u in srvData
                                                 join p in UserFb.Friends on LIB.StringHelper.Right(u.OpAddress.TrimEnd(), 10) equals p.Msisdn
                                                 into a
                                                 from f in a.DefaultIfEmpty(new UserFbFriendModel())
                                                 select new CallDetailModel
            {
                Amount = u.Amount,
                DataVolume = u.DataVolume,
                DateDisplay = u.DateDisplay,
                Description = u.Description,
                OpAddress = ProjectUtil.CallDetailOpAddres(u.OpAddress, session.IsSubscriptionActive),

                PictureLink = f.PictureLink,
                UserId = f.UserId,
                FbId = f.FbId,
                FirstNameView = f.FirstNameView,
                IsClickToCallBlock = f.IsClickToCallBlock,
                IsClickToCallInvisible = f.IsClickToCallInvisible,
                LastNameView = f.LastNameView,
            })
                                                .Where(f => f.FbId == friendFbId)
                                                .ToList();

            return(Json(modelList.ToList(), JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 20
0
        static System.Threading.Tasks.Task ProcessOutputStreamReader(
            System.IO.StreamReader reader,
            RustProjectNode rustProjectNode,
            string category               = "BUILD",
            bool printBuildOutput         = true,
            bool printRustcParsedMessages = false)
        {
            return(System.Threading.Tasks.Task.Run(() =>
            {
                string errorOutput = reader.ReadToEnd();
                var rustcErrors = RustcOutputProcessor.ParseOutput(errorOutput);

                if (printBuildOutput)
                {
                    ProjectUtil.PrintToBuild(errorOutput);
                }

                foreach (var msg in rustcErrors)
                {
                    TaskMessages.QueueRustcMessage("Rust", msg, rustProjectNode, refresh: false);
                    if (printRustcParsedMessages)
                    {
                        ProjectUtil.PrintToBuild(msg.ToString());
                    }
                }
                TaskMessages.Refresh();
            }));
        }
Exemplo n.º 21
0
        internal Converter(string solutionFilePath)
        {
            ProjectNameMap  = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);
            AssemblyNameMap = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);

            foreach (var entry in SolutionUtil.ParseLanguageProjectsRooted(solutionFilePath))
            {
                if (ExcludedProjectSet.Contains(entry.Name))
                {
                    continue;
                }

                var util         = new ProjectUtil(entry.FilePath);
                var assemblyName = util.AssemblyNameWithoutExtension;
                var name         = entry.Name;
                if (InitialProjectRenameMap.TryGetValue(name, out var data))
                {
                    ProjectNameMap[name]          = data.NewProjectName;
                    AssemblyNameMap[assemblyName] = data.NewAssemblyName;
                }
                else
                {
                    ProjectNameMap[name] = assemblyName;
                }
            }
        }
Exemplo n.º 22
0
        protected virtual bool BuildManifest()
        {
            BuildDir = Path.GetDirectoryName(Project.FullName) + "\\bin\\" + SolutionBuild.ActiveConfiguration.Name +
                       "\\";
            string cacheDir = Common.GetHostDir() + "\\_Projects\\" + Project.FullName.MD5() + "\\project.xml";

            CacheHelper = new CacheHelper <ProjectCache>();
            try
            {
                ProjectCache = CacheHelper.Get(cacheDir);
            }
            catch
            {
                ProjectCache = new ProjectCache();
            }

            if (_productToRelease == null)
            {
                _productToRelease = ProjectUtil.GetProductInfo(Project);
            }
            List <FileListItem> files = GatherFiles(BuildDir);
            ////string releaseFileName = Path.GetDirectoryName(prj.FullName) + "\\" + Common.ManifestFileName;

            string releaseFileName = Path.GetDirectoryName(Project.FullName) + "\\bin\\" + Common.ManifestFileName;

            if (File.Exists(releaseFileName))
            {
                Manifest = FileUtil.ReadManifest(releaseFileName);
            }
            if (Manifest == null)
            {
                string[] icons = Directory.GetFiles(BuildDir, "*.ico");
                Manifest = new Manifest
                {
                    AppName      = _productToRelease.Name,
                    Company      = _productToRelease.CompanyName,
                    EntryPoint   = Common.GetAssemblyName(Project) + ".exe",
                    ShortcutIcon = icons.Length > 0 ? Path.GetFileName(icons[0]) : ""
                };
            }
            Manifest.ReleaseVersion = _productToRelease.Version;
            Manifest.MinVersion     = _productToRelease.Version;

            var f = new ReleaseForm(BuildDir, files, Manifest);

            f.ZipOnly = ZipOnly;
            if (f.ShowDialog() == DialogResult.OK)
            {
                if (ProjectCache == null)
                {
                    ProjectCache = new ProjectCache();
                }
                ProjectCache.ExcludeFiles   = f.GetExcludedFiles().ToList();
                ProjectCache.ExcludeFolders = f.GetExcludedFolders().ToList();
                CacheHelper.Save(ProjectCache, cacheDir);
                return(true);
            }
            return(false);
        }
 public static IEnumerable <IProjectFile> GetAllProjectFilesWithPathPrefix(this IEnumerable <IProject> projects, string prefix)
 {
     return
         ((from project in projects
           from file in project.GetAllProjectFiles()
           where ProjectUtil.GetRelativePresentableProjectPath(file, project).StartsWith(prefix)
           select file).ToList());
 }
Exemplo n.º 24
0
        public void MakeRootedRelativeToAssets()
        {
            string subdir   = "Some/Sub/Dir";
            string path     = Path.Combine(Application.dataPath, subdir);
            string relative = ProjectUtil.MakePathRelativeToAssets(path);

            Assert.AreEqual(subdir, relative);
        }
Exemplo n.º 25
0
 public void OnGenCode(ConfigInfo configInfo)
 {
     this.Info = configInfo;
     ProjectUtil.Log("cur Dir" + AppDomain.CurrentDomain.BaseDirectory);
     //. build ECDefine project
     //ExecuteCmd(Info.BuildECdefineShell, Info.BuildECdefineShellWorkingDir);
     //. parse define file and gen entitas code
     ParseECDefine();
 }
Exemplo n.º 26
0
 public Inventory.InventoryInfo Replace(int slot, Inventory.InventoryInfo info)
 {
     Inventory.InventoryInfo result = inventory.Replace(slot, info);
     if (ProjectUtil.IsEquipmentSlot(slot))
     {
         UpdateWeapons(slot - inventory.size);
     }
     return(result);
 }
Exemplo n.º 27
0
        public void MakeAbsoluteExternalPathPRelativeToProject()
        {
            string path = Directory.GetParent(Application.dataPath).Parent.Parent.FullName;

            path = Path.Combine(path, "foo foo");
            string rel = ProjectUtil.MakePathRelativeToProject(path);

            Assert.AreEqual(rel, "../../foo foo");
        }
Exemplo n.º 28
0
    public bool Swap(int slot1, int slot2)
    {
        bool result = inventory.Swap(slot1, slot2);

        if (result && (ProjectUtil.IsEquipmentSlot(slot1) || ProjectUtil.IsEquipmentSlot(slot2)))
        {
            UpdateWeapons();
        }
        return(result);
    }