Exemple #1
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            var   id          = "";
            var   data        = "";
            Curve innerBounds = null;
            Curve outerBounds = null;

            DA.GetData(0, ref id);
            DA.GetData(1, ref data);
            DA.GetData(2, ref innerBounds);
            DA.GetData(3, ref outerBounds);

            var req = new CiceroRequest(data, innerBounds, outerBounds);

            SolutionManifest res = Parse.Request(req);

            res.RunContainment();
            res.RunVerbs();
            res.RunAdverbs();

            var dwg = Compose.Drawing(res);

            dwg.Build();

            var path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\cicero\\svg\\" + id + ".svg";

            io.File.WriteAllText(path, dwg.SvgText.ToString());

            var crvs = new List <Curve>();

            res.BoxElements.ForEach(x => x.InputSegments.ForEach(y => crvs.Add(y)));

            DA.SetDataList(0, res.InputLines);
        }
Exemple #2
0
        public void InstallSolution(string directory, string solutionName, string solutionVersion, string localization, uint?deployMode)
        {
            // Downloading solution manifest
            Console.WriteLine("Downloading solution manifest for release {0}", solutionVersion);
            var solutionFolder = String.Format("{0}/RADS/solutions/{1}/releases/{2}", directory, solutionName, solutionVersion);

            System.IO.Directory.CreateDirectory(solutionFolder);
            webClient.DownloadFile(
                String.Format("{0}/releases/{1}/solutions/{2}/releases/{3}/solutionmanifest", LeagueCDN, Platform, solutionName, solutionVersion),
                solutionFolder + "/solutionmanifest");
            var            solutionManifest = new SolutionManifest(File.ReadAllLines(solutionFolder + "/solutionmanifest"));
            LocalizedEntry localizedEntry   = solutionManifest.LocalizedEntries.Find(x => x.Name.Equals(localization, StringComparison.InvariantCultureIgnoreCase));

            if (localizedEntry != null)
            {
                // Creating configuration manifest
                var configurationManifest = new ConfigurationManifest(localizedEntry);
                configurationManifest.Write(solutionFolder + "/configurationmanifest");

                // Downloading each project
                foreach (SolutionProject project in localizedEntry.Projects)
                {
                    InstallProject(directory, project.Name, project.Version, deployMode, solutionName, solutionVersion);
                }

                File.Create(solutionFolder + "/S_OK").Close();
            }
        }
Exemple #3
0
        public static SvgDocument Drawing(SolutionManifest res)
        {
            var bounds = res.Bounds.GetBoundingBox(false);

            var svgData = new SvgDocument(new Rectangle3d(Plane.WorldXY, bounds.Min, bounds.Max));

            foreach (BoxElement box in res.BoxElements)
            {
                foreach (Curve crv in box.VerbResults)
                {
                    svgData.Curves.Add(crv);
                    svgData.Styles.Add(Styles.Get(box.Verb));
                }
            }

            return(svgData);
        }