ToString() public method

public ToString ( ) : string
return string
Example #1
0
        public void Show(Section section)
        {
            var sectionType = System.Reflection.Assembly.GetExecutingAssembly().GetTypes()
                              .Where(type => type.GetMethod(section.ToString()) != null)
                              .First();

            var sectionMethod = sectionType.GetMethod(section.ToString());

            var instance = Activator.CreateInstance(sectionType);

            sectionMethod.Invoke(instance, null);
        }
Example #2
0
        protected void AddItemToWorld(List <Property> properties)
        {
            string eventType = "";

            if (CurrentSection == Section.Events || CurrentSection == Section.EventCollections)
            {
                eventType = properties.Find(property => property.Name == "type")?.Value ?? "undefined";
            }

            if (CurrentSection != Section.Events && CurrentSection != Section.EventCollections)
            {
                AddFromXmlSection(CurrentSection, properties);
            }
            else if (CurrentSection == Section.EventCollections)
            {
                AddEventCollection(eventType, properties);
            }
            else if (CurrentSection == Section.Events)
            {
                AddEvent(eventType, properties);
            }

            string path = CurrentSection.ToString();

            if (CurrentSection == Section.Events || CurrentSection == Section.EventCollections)
            {
                path += " '" + eventType + "'/";
            }

            CheckKnownStateOfProperties(path, properties);
        }
Example #3
0
 public static async Task<Response<List<Image>>> GetGallery(Section? section = null, Sort? sort = null, Window? window = null, bool? showViral = null, int? page = null)
 {
     string uri = "gallery";
     if (section != null)
     {
         uri += "/" + section.ToString().ToLower();
         if(sort != null)
         {
             uri += "/" + sort.ToString().ToLower();
             if(window != null)
             {
                 uri += "/" + window.ToString().ToLower();
                 if (showViral != null)
                 {
                     uri += "/" + showViral.ToString();
                     if (page != null)
                     {
                         uri += "/" + page;
                     }
                 }
             }
         }
     }
     return await NetworkHelper.GetRequest<List<Image>>(uri);
 }
Example #4
0
        public void ISectionToString_Success()
        {
            string   sectionIdString = "1234B012";
            ISection section         = new Section(SectionID.FromString(sectionIdString));

            Assert.AreEqual(sectionIdString, section.ToString());
        }
Example #5
0
 private static string GetSection(Section section)
 {
     switch (section)
     {
     default: return(section.ToString());
     }
 }
Example #6
0
        public void AddFromXMLSection(Section section, List <Property> properties)
        {
            switch (section)
            {
            case Section.Regions: World.Regions.Add(new WorldRegion(properties, World)); break;

            case Section.UndergroundRegions: World.UndergroundRegions.Add(new UndergroundRegion(properties, World)); break;

            case Section.Sites: World.Sites.Add(new Site(properties, World)); break;

            case Section.HistoricalFigures: World.HistoricalFigures.Add(new HistoricalFigure(properties, World)); break;

            case Section.EntityPopulations: World.EntityPopulations.Add(new EntityPopulation(properties, World)); break;

            case Section.Entities: World.Entities.Add(new Entity(properties, World)); break;

            case Section.Eras: World.Eras.Add(new Era(properties, World)); break;

            case Section.Artifacts: World.Artifacts.Add(new Artifact(properties, World)); break;

            case Section.WorldConstructions: World.WorldContructions.Add(new WorldContruction(properties, World)); break;

            default: World.ParsingErrors.Report("Unknown XML Section: " + section.ToString()); break;
            }
        }
Example #7
0
    private void RemoveNOldestTextRegistered(Section section, int quantity)
    {
        Dictionary <string, List <string> > clonedCs = GetCloneOfDictionary(textsRegistered);

        clonedCs[section.ToString()].RemoveRange(0, quantity);
        textsRegistered = clonedCs;
    }
Example #8
0
    public void RemoveTextRegistered(Section section, string textId)
    {
        Dictionary <string, List <string> > clonedCs = GetCloneOfDictionary(textsRegistered);

        clonedCs[section.ToString()].Remove(textId);
        textsRegistered = clonedCs;
    }
Example #9
0
        public void SetBytes(Game game, Platform platform, ref List <byte> listBytes)
        {
            int position = listBytes.Count();

            listBytes.AddRange(new byte[] {
                0, 0, 0, 0,
                0, 0, 0, 0,
            });

            SetListBytes(game, platform, ref listBytes);

            sectionSize = listBytes.Count() - position - 0x8;

            var sectionNameString = sectionType.ToString();
            var sectionSizeBytes  = BitConverter.GetBytes(sectionSize);

            listBytes[position + 0] = (byte)sectionNameString[0];
            listBytes[position + 1] = (byte)sectionNameString[1];
            listBytes[position + 2] = (byte)sectionNameString[2];
            listBytes[position + 3] = (byte)sectionNameString[3];
            listBytes[position + 4] = sectionSizeBytes[3];
            listBytes[position + 5] = sectionSizeBytes[2];
            listBytes[position + 6] = sectionSizeBytes[1];
            listBytes[position + 7] = sectionSizeBytes[0];
        }
Example #10
0
 public void WriteConfig(Section section, Key key, double value)
 {
     if (config != null)
     {
         Debug.Log(key + " => " + value);
         config[section.ToString()][key.ToString()].DoubleValue = value;
     }
 }
Example #11
0
 public bool ReadConfigBoolean(Section section, Key key)
 {
     if (config != null)
     {
         return(config[section.ToString()][key.ToString()].BoolValue);
     }
     return(false);
 }
Example #12
0
 public double ReadConfigDouble(Section section, Key key)
 {
     if (config != null)
     {
         return(config[section.ToString()][key.ToString()].DoubleValue);
     }
     return(0.0);
 }
Example #13
0
 public float ReadConfigFloat(Section section, Key key)
 {
     if (config != null)
     {
         return(config[section.ToString()][key.ToString()].FloatValue);
     }
     return(0.0f);
 }
Example #14
0
 public int ReadConfigInteger(Section section, Key key)
 {
     if (config != null)
     {
         return(config[section.ToString()][key.ToString()].IntValue);
     }
     return(0);
 }
Example #15
0
 public string ReadConfigString(Section section, Key key)
 {
     if (config != null)
     {
         return(config[section.ToString()][key.ToString()].StringValue);
     }
     return(null);
 }
Example #16
0
        public void ToStringはテストケースの情報とをセクション名を表す文字列を返す()
        {
            // setup
            Section section = testCase.GetSection(1);

            // expect
            Assert.AreEqual("BookTest.xlsx#Sheet01[テストケース001], A. テストケース", section.ToString());
        }
Example #17
0
        public void ToString_WillReturnTheCorrectFormat()
        {
            Section section = new Section {
                Name = "Sec1"
            };

            var s = section.ToString();

            Assert.AreEqual("  Sec1", s);
        }
Example #18
0
        public void Show(Section section)
        {
            Console.WriteLine($"Value1: {value1}");
            Console.WriteLine($"Value2: {value2}");
            Console.WriteLine();

            var sectionAnswers = typeof(Answers).GetMethod(section.ToString());

            sectionAnswers.Invoke(this, null);
        }
Example #19
0
        public void ToString_WillReturnTheCorrectString()
        {
            var section = new Section {
                Name = "Sec"
            };

            var s = section.ToString();

            Assert.IsTrue(s.Contains("  Sec"));
        }
Example #20
0
        /// <inheritdoc />
        protected override void AddAttributesToRender(HtmlTextWriter writer)
        {
            if (Section == CanvasSection.None)
            {
                throw new MissingRequiredAttribute("Section", Section);
            }

            writer.AddAttribute("section", Section.ToString().ToLowerInvariant());

            base.AddAttributesToRender(writer);
        }
Example #21
0
        public void ToStringCreatesIniFileSection()
        {
            const string EXPECTED = "[Foo]\r\nBar=Baz\r\nToz=Taz\r\n\r\n";

            var section = new Section("Foo");

            section.Add(new Property("Bar", "Baz"));
            section.Add(new Property("Toz", "Taz"));

            Assert.AreEqual(EXPECTED, section.ToString());
        }
        public void ToString_WillReturnTheCorrectFormatAndTheQuestions()
        {
            Section section = new Section {
                Name = "Sec1", Questions = new List <IQuestion> {
                    new FreeTextQuestion(), new FreeTextQuestion()
                }
            };

            var s = section.ToString();

            Assert.That(s, Contains.Substring("   ___"));
            Assert.That(s, Contains.Substring("  Sec1"));
        }
Example #23
0
        public static string ReadIni(Section section, Key key = Key.day)
        {
            StringBuilder temp = new StringBuilder(255);
            int           ret  = GetPrivateProfileString(
                section.ToString()
                , key == Key.day ? DateTime.Today.ToString("yyyyMMdd") : key.ToString()
                , section == Section.Day ? "1" : ""
                , temp
                , 255
                , string.Format(@"{0}\ini.ini", Application.StartupPath));

            return(temp.ToString());
        }
Example #24
0
        public void ToString_WillReturnTheCorrectFormatForSections()
        {
            var section = new Section {
                Name = "Sec"
            };

            section.Items.Add(new FreeTextQuestion());

            var s = section.ToString();

            Assert.IsTrue(s.Contains("  Sec"));
            Assert.IsTrue(s.Contains("   ___"));
        }
Example #25
0
        public void Section_ToString()
        {
            var subsection = new Subsection("Subsection");

            Assert.AreEqual(@"Subsection { Title: ""Subsection"" }", subsection.ToString());

            var section = new Section("Section");

            Assert.AreEqual(@"Section { Title: ""Section"", Subsections: [] }", section.ToString());

            section.Add(subsection, new Subsection("第二款"));
            Assert.AreEqual(@"Section { Title: ""Section"", Subsections: [Subsection { Title: ""Subsection"" }, Subsection { Title: ""第二款"" }] }", section.ToString());
        }
Example #26
0
        public void ToString_WillReturnTheCorrectFormat()
        {
            var section = new Section {
                Name = "Sec", Items = new ItemsCollection {
                    new FreeTextQuestion()
                }
            };

            string s = section.ToString();

            Assert.AreEqual(@"  Sec
   ___", s);
        }
Example #27
0
        public void ToString_WhenSectionHasQuestions_WillReturnTheSectionWithQuestions()
        {
            List <IQuestion> questions = new List <IQuestion> {
                new FreeTextQuestion(), new FreeTextQuestion()
            };
            Section section = new Section {
                Name = "Sec1", Questions = questions
            };

            var s = section.ToString();

            Assert.That(s, Contains.Substring(@"  Sec1
   ___"));
        }
        public void ToString_WillReturnTheCorectFormat()
        {
            Section section = new Section {
                Name = "Sec1", Questions = new List <IQuestion> {
                    new FreeTextQuestion(), new FreeTextQuestion()
                }
            };

            var s = section.ToString();

            Assert.IsTrue(s.Contains("  Sec1"));
            Assert.IsTrue(s.Contains(@"  Sec1
   ___"));
        }
Example #29
0
    public void ChangeSection(Section newSec, int poolCount)
    {
        foreach (GameObject obj in GameObject.FindGameObjectsWithTag("EnergyBox"))
        {
            EngBarCon objCon = obj.GetComponent <EngBarCon>();
            if (objCon.section == newSec)
            {
                currentBar = objCon;
            }
        }

        currSection = newSec;
        Debug.Log(currSection.ToString());
        isInUse = true;
        StartCoroutine(GamCon.Instance.deathCountdown(useTime * poolCount, gameObject));
    }
Example #30
0
        protected void AddItemToWorld(List <Property> properties)
        {
            string eventType = "";

            if (CurrentSection == Section.Events || CurrentSection == Section.EventCollections)
            {
                eventType = properties.First(property => property.Name == "type").Value;
            }

            if (CurrentSection != Section.Events && CurrentSection != Section.EventCollections)
            {
                AddFromXMLSection(CurrentSection, properties);
            }
            else if (CurrentSection == Section.EventCollections)
            {
                AddEventCollection(eventType, properties);
            }
            else if (CurrentSection == Section.Events)
            {
                AddEvent(eventType, properties);
            }

            foreach (Property property in properties)
            {
                string section = "";
                if (CurrentSection == Section.Events || CurrentSection == Section.EventCollections)
                {
                    section = eventType;
                }
                else
                {
                    section = CurrentSection.ToString();
                }

                if (!property.Known && property.SubProperties.Count == 0)
                {
                    World.ParsingErrors.Report("Unknown " + section + " Property: " + property.Name, property.Value);
                }
                foreach (Property subProperty in property.SubProperties)
                {
                    if (!subProperty.Known)
                    {
                        World.ParsingErrors.Report("Unknown " + section + " Property: " + property.Name + " - " + subProperty.Name, subProperty.Value);
                    }
                }
            }
        }
        private async Task <IEnumerable <ArticleJson> > GetArticlesBySectionAsync(Section section)
        {
            _restClient.BaseUrl = new Uri(_apiConfig.BaseUrl);

            var request = new RestRequest("svc/topstories/v2/{section}.json", Method.GET);

            request.AddUrlSegment("section", section.ToString().ToLower());
            request.AddParameter("api-key", _apiConfig.Id);

            var restResponse = await _restClient.ExecuteTaskAsync(request);

            if (!restResponse.IsSuccessful)
            {
                throw new Exception(restResponse.ErrorMessage);
            }

            return(JsonConvert.DeserializeObject <ArticlesJson>(restResponse.Content).Results);
        }
Example #32
0
 /// <summary>
 /// Gets the gallery
 /// </summary>
 /// <param name="section"></param>
 /// <param name="sort"></param>
 /// <param name="page"></param>
 /// <param name="showViral">Used only when section is "user"</param>
 /// <returns></returns>
 public static async Task<Response<List<Image>>> GetGallery(Section? section = null, Sort? sort = null, int? page = null, bool? showViral = null)
 {
     string uri = "gallery";
     if (section != null)
     {
         uri += "/" + section.ToString().ToLower();
         if (sort != null)
         {
             if (page != null)
             {
                 uri += "/" + page;
             }
         }                
     }
     if (showViral != null)
         uri += ("?showViral=" + showViral.ToString().ToLower());
     var response = await NetworkHelper.GetRequest<List<Image>>(uri);
     return response;
 }
Example #33
0
        private static bool CheckVersionSection(Rule rule,
            Section section,
            IEnumerable<StoreActivitiesDC> previousVersions,
            StoreActivitiesDC workflowToTest,
            ref string errorString)
        {
            var isRulePassed = true; // defaults to a state of passing the section

            // make a lookup so we can easily determine the required change, without resorting to a switch statement or similar
            var ruleActions = new Dictionary<Section, RequiredChange>
                                  {
                                     {Section.Major,    rule.MajorRequiredChange},
                                     {Section.Minor,    rule.MinorRequiredChange},
                                     {Section.Build,    rule.BuildRequiredChange},
                                     {Section.Revision, rule.RevisionRequiredChange},
                                  };

            var ruleAction = ruleActions.First(ruleAction1 => ruleAction1.Key == section).Value;

            if (ruleAction != RequiredChange.NoActionRequired)
            {
                var sectionValue = GetVersionSection(workflowToTest.Version, section); // the value of the specified piece of the version number

                switch (ruleAction)
                {
                    case RequiredChange.MustIncrement:
                        if (previousVersions.Any())
                            isRulePassed = previousVersions
                                               .Select(workflow => GetVersionSection(workflow.Version, section))
                                               .Max() < sectionValue;
                        if (!isRulePassed)
                            errorString += string.Format(MustBeIncrementedMessage, section.ToString());

                        break;

                    case RequiredChange.MustReset:
                        isRulePassed = (sectionValue == versionSectionResetValues[section]);
                        if (!isRulePassed)
                            errorString += string.Format(MustBeResetMessage, section, versionSectionResetValues[section]);

                        break;

                    default:
                        throw new NotImplementedException();
                }
            }

            return isRulePassed;
        }
Example #34
0
		public static RootElement TestElements()
		{
			RootElement re1 = new RootElement("re1");
			Debug.WriteLine(re1.ToString());
			Section s1 = new Section();
			Debug.WriteLine(s1.ToString());
			//Section s2 = new Section(new Android.Views.View(a1));
			//Debug.WriteLine(s2.ToString());
			Section s3 = new Section("s3");
			Debug.WriteLine(s3.ToString());
			//Section s4 = new Section
			//					(
			//					  new Android.Views.View(a1)
			//					, new Android.Views.View(a1)
			//					);
			//Debug.WriteLine(s4.ToString());
			Section s5 = new Section("caption", "footer");
			Debug.WriteLine(s5.ToString());

			StringElement se1 = new StringElement("se1");
			Debug.WriteLine(se1.ToString());
			StringElement se2 = new StringElement("se2", delegate() { });
			Debug.WriteLine(se2.ToString());
			//StringElement se3 = new StringElement("se3", 4);
			StringElement se4 = new StringElement("se4", "v4");
			Debug.WriteLine(se4.ToString());
			//StringElement se5 = new StringElement("se5", "v5", delegate() { });
			
			// removed - protected (all with LayoutID)
			// StringElement se6 = new StringElement("se6", "v6", 4);
			// Debug.WriteLine(se6.ToString());

			// not cross platform! 
			// TODO: make it!?!?!?
			// AchievementElement
			
			BooleanElement be1 = new BooleanElement("be1", true);
			Debug.WriteLine(be1.ToString());
			BooleanElement be2 = new BooleanElement("be2", false, "key");
			Debug.WriteLine(be2.ToString());
			
			// Abstract
			// BoolElement be3 = new BoolElement("be3", true);

			CheckboxElement cb1 = new CheckboxElement("cb1");
			Debug.WriteLine(cb1.ToString());
			CheckboxElement cb2 = new CheckboxElement("cb2", true);
			Debug.WriteLine(cb2.ToString());
			CheckboxElement cb3 = new CheckboxElement("cb3", false, "group1");
			Debug.WriteLine(cb3.ToString());
			CheckboxElement cb4 = new CheckboxElement("cb4", false, "subcaption", "group2");
			Debug.WriteLine(cb4.ToString());

			DateElement de1 = new DateElement("dt1", DateTime.Now);
			Debug.WriteLine(de1.ToString());

			// TODO: see issues 
			// https://github.com/kevinmcmahon/MonoDroid.Dialog/issues?page=1&state=open
			EntryElement ee1 = new EntryElement("ee1", "ee1");
			Debug.WriteLine(ee1.ToString());
			EntryElement ee2 = new EntryElement("ee2", "ee2 placeholder", "ee2 value");
			Debug.WriteLine(ee2.ToString());
			EntryElement ee3 = new EntryElement("ee3", "ee3 placeholder", "ee3 value", true);
			Debug.WriteLine(ee3.ToString());

			FloatElement fe1 = new FloatElement("fe1");
			Debug.WriteLine(fe1.ToString());
			FloatElement fe2 = new FloatElement(-0.1f, 0.1f, 3.2f);
			Debug.WriteLine(fe2.ToString());
			FloatElement fe3 = new FloatElement
									(
									  null
									, null // no ctors new Android.Graphics.Bitmap()
									, 1.0f
									);
			Debug.WriteLine(fe3.ToString());

			HtmlElement he1 = new HtmlElement("he1", "http://holisiticware.net");
			Debug.WriteLine(he1.ToString());

			
			// TODO: image as filename - cross-platform
			ImageElement ie1 = new ImageElement(null);
			Debug.WriteLine(ie1.ToString());

			// TODO: not in Kevin's MA.D
			// ImageStringElement

			MultilineElement me1 = new MultilineElement("me1");
			Debug.WriteLine(me1.ToString());
			MultilineElement me2 = new MultilineElement("me2", delegate() { });
			Debug.WriteLine(me2.ToString());
			MultilineElement me3 = new MultilineElement("me3", "me3 value");
			Debug.WriteLine(me3.ToString());

			RadioElement rde1 = new RadioElement("rde1");
			Debug.WriteLine(rde1.ToString());
			RadioElement rde2 = new RadioElement("rde1", "group3");
			Debug.WriteLine(rde2.ToString());

			// TODO: not in Kevin's MA.D
			// StyledMultilineElement

			TimeElement te1 = new TimeElement("TimeElement", DateTime.Now);
			Debug.WriteLine(te1.ToString());



			re1.Add(s1);
			//re1.Add(s2);
			re1.Add(s3);
			//re1.Add(s4);
			re1.Add(s5);

			return re1;
		}
Example #35
0
 public void AddFromXMLSection(Section section, List<Property> properties)
 {
     switch (section)
     {
         case Section.Regions: World.Regions.Add(new WorldRegion(properties, World)); break;
         case Section.UndergroundRegions: World.UndergroundRegions.Add(new UndergroundRegion(properties, World)); break;
         case Section.Sites: World.Sites.Add(new Site(properties, World)); break;
         case Section.HistoricalFigures: World.HistoricalFigures.Add(new HistoricalFigure(properties, World)); break;
         case Section.EntityPopulations: World.EntityPopulations.Add(new EntityPopulation(properties, World)); break;
         case Section.Entities: World.Entities.Add(new Entity(properties, World)); break;
         case Section.Eras: World.Eras.Add(new Era(properties, World)); break;
         case Section.Artifacts: World.Artifacts.Add(new Artifact(properties, World)); break;
         case Section.WorldConstructions: break;
         default: World.ParsingErrors.Report("Unknown XML Section: " + section.ToString()); break;
     }
 }