Exemplo n.º 1
0
    public static void Main(string[] args)
    {
        var containers = new StringContainer[1];

        containers[0] = new StringContainer(args[0]);
        Console.WriteLine(containers[0].Contents);
    }
Exemplo n.º 2
0
        //When you select an item from the 'City' list in the 'Select Location' group.
        private void cityDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            zipList.Clear();
            StringContainer cityObj = (StringContainer)cityDataGrid.SelectedItem;
            String          state   = (String)selectStateComboBox.SelectedItem;

            if (cityObj == null || state == null)
            {
                zipCodeDataGrid.Items.Refresh(); return;
            }
            String city = cityObj.ToString();

            using (NpgsqlConnection sqlconn = new NpgsqlConnection(login))
            {//Start SQL interaction
                sqlconn.Open();
                using (NpgsqlCommand cmd = new NpgsqlCommand())
                {
                    cmd.Connection  = sqlconn;
                    cmd.CommandText = "SELECT distinct zipcode FROM business WHERE state = '" + state + "' AND city = '" + city + "' order by zipcode; ";

                    using (NpgsqlDataReader reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            zipList.Add(new StringContainer(reader.GetString(0)));
                        }
                    }

                    zipCodeDataGrid.ItemsSource = zipList;
                    zipCodeDataGrid.Items.Refresh();
                }
                sqlconn.Close();
            }//End SQL interaction
        }
Exemplo n.º 3
0
        public void TestUltraNestingWithoutEnclosingParens()
        {
            var container = StringContainer.Get("data(name1,age1),id(name2,age2(hello,bye)),you(name3,age3)");

            Assert.AreEqual(container.Children[0].Data, "data");
            Assert.AreEqual(container.Children[0].Children[0].Data, "name1");
            Assert.IsNull(container.Children[0].Children[0].Children);
            Assert.AreEqual(container.Children[0].Children[1].Data, "age1");
            Assert.IsNull(container.Children[0].Children[1].Children);

            Assert.AreEqual(container.Children[1].Data, "id");
            Assert.AreEqual(container.Children[1].Children[0].Data, "name2");
            Assert.IsNull(container.Children[1].Children[0].Children);
            Assert.AreEqual(container.Children[1].Children[1].Data, "age2");
            Assert.AreEqual(container.Children[1].Children[1].Children[0].Data, "hello");
            Assert.IsNull(container.Children[1].Children[1].Children[0].Children);
            Assert.AreEqual(container.Children[1].Children[1].Children[1].Data, "bye");
            Assert.IsNull(container.Children[1].Children[1].Children[0].Children);

            Assert.AreEqual(container.Children[2].Data, "you");
            Assert.AreEqual(container.Children[2].Children[0].Data, "name3");
            Assert.IsNull(container.Children[2].Children[0].Children);
            Assert.AreEqual(container.Children[2].Children[1].Data, "age3");
            Assert.IsNull(container.Children[2].Children[1].Children);
        }
Exemplo n.º 4
0
        private async Task ConfigSendGridasync(IdentityMessage message)
        {
            string html = StringContainer.MessageMaker(message.Body);

            var myMessage = new SendGridMessage();

            myMessage.AddTo(message.Destination);
            myMessage.From    = new MailAddress("*****@*****.**", "WoW Team");
            myMessage.Subject = message.Subject;
            myMessage.Text    = message.Body;
            myMessage.Html    = html;

            var credentials = new NetworkCredential
                              (
                ConfigurationSettings.AppSettings["emailService:Account"],
                ConfigurationSettings.AppSettings["emailService:Password"]
                              );

            var transportWeb = new Web(credentials);

            if (transportWeb == null)
            {
                throw new ArgumentNullException();
            }
            else
            {
                await transportWeb.DeliverAsync(myMessage);

                await Task.FromResult(0);
            }
        }
Exemplo n.º 5
0
        public void TestOneChild()
        {
            var container = StringContainer.Get("(id)");

            Assert.AreEqual(container.Children[0].Data, "id");
            Assert.IsNull(container.Children[0].Children);
        }
Exemplo n.º 6
0
        public void TestEmptyString()
        {
            var container = StringContainer.Get(string.Empty);

            Assert.AreEqual(container.Data, string.Empty);
            Assert.IsNull(container.Children);
        }
Exemplo n.º 7
0
    public static void Main(string[] args)
    {
        var container = new StringContainer();

        container.Contents = args[0];
        Print(ref container.Contents);
    }
Exemplo n.º 8
0
        public void TestSuperDeepNestedString()
        {
            string str       = "(id,created,employee(id,firstname,employeeType(id),lastname,employee(id,firstname,employeeType(id),lastname,employee(id,firstname,employeeType(id),lastname,employee(id,firstname,employeeType(id),lastname,employee(id,firstname,employeeType(id),lastname,employee(id,firstname,employeeType(id),lastname,employee(id,firstname,employeeType(id),lastname,employee(id,firstname,employeeType(id),lastname,employee(id,firstname,employeeType(id),lastname,employee(id,firstname,employeeType(id),lastname,employee(id,firstname,employeeType(id),lastname,employee(id,firstname,employeeType(id),lastname,employee(id,firstname,employeeType(id),lastname,employee(id,firstname,employeeType(id),lastname,employee(id,firstname,employeeType(id),lastname,employee(id,firstname,employeeType(id),lastname,employee(id,firstname,employeeType(id),lastname,employee(id,firstname,employeeType(id),lastname,employee(id,firstname,employeeType(id),lastname,employee(id,firstname,employeeType(id),lastname,employee(id,firstname,employeeType(id),lastname,employee(id,firstname,employeeType(id),lastname,employee(id,firstname,employeeType(id),lastname))))))))))))))))))))))),location(id,lat,long),something,anything)";
            var    container = StringContainer.Get(str);

            container.Sort();
        }
Exemplo n.º 9
0
        public void TestMismatchedParents()
        {
            var container = StringContainer.Get(")(");

            Assert.AreEqual(container.Data, string.Empty);
            Assert.AreEqual(container.Children[0].Data, string.Empty);
        }
Exemplo n.º 10
0
        public void TestEmptyParens()
        {
            var container = StringContainer.Get("()");

            Assert.AreEqual(container.Data, string.Empty);
            Assert.AreEqual(container.Children[0].Data, string.Empty);
        }
Exemplo n.º 11
0
        public static string WriteObject(StringContainer value, int indent, JIndentCfg cfg)
        {
            string tmp = "{\n";

            if (indent != 0 && cfg.IndentOpenCurlyBrace)
            {
                tmp = "\n" + StringUtil.PrependChar(tmp, cfg.IndentString, indent);
            }
            IEnumerator <string> keys = value.Keys.GetEnumerator();

            for (int x = -1; ++x < value.Count - 1;)
            {
                keys.MoveNext();
                tmp += StringUtil.PrependChar(WriteMember(keys.Current, value[keys.Current], indent + 1, cfg), cfg.IndentString, indent + 1);
                tmp += ",\n";
                for (int i = -1; ++i < cfg.ObjectSpacing;)
                {
                    tmp += cfg.IndentSpacing ? StringUtil.PrependChar("\n", cfg.IndentString, indent + 1) : "\n";
                }
            }

            if (keys.MoveNext())
            {
                tmp += StringUtil.PrependChar(WriteMember(keys.Current, value[keys.Current], indent + 1, cfg), cfg.IndentString, indent + 1);
            }
            return(tmp + "\n" + StringUtil.PrependChar("}", cfg.IndentString, indent));
        }
Exemplo n.º 12
0
        internal static JObject CreateFromRef(StringContainer sc)
        {
            JObject tmp = new JObject();

            tmp.content = sc;
            return(tmp);
        }
Exemplo n.º 13
0
    public static void Main(string[] args)
    {
        var container = new StringContainer();

        container.Contents = args[0];
        Console.WriteLine(container.Contents);
    }
Exemplo n.º 14
0
        public StringContainer HtmlEncode(StringContainer input)
        {
            var output = HttpUtility.HtmlEncode(input.Text);

            return(new StringContainer {
                Text = output
            });
        }
Exemplo n.º 15
0
        public StringContainer Base64Decode(StringContainer input)
        {
            var base64EncodedBytes = System.Convert.FromBase64String(input.Text);

            return(new StringContainer {
                Text = System.Text.Encoding.UTF8.GetString(base64EncodedBytes)
            });
        }
Exemplo n.º 16
0
        public ResultContainer AddMovie([FromBody] StringContainer stringContainer)
        {
            ResultContainer result;

            result = movieLibary.AddMovie(stringContainer.str);

            return(result);
        }
Exemplo n.º 17
0
        public async Task <ResultContainer> AddFolSeries([FromBody] StringContainer stringContainer)
        {
            ResultContainer result;

            result = await seriesLibary.AddSeries(stringContainer.str, database);

            return(result);
        }
Exemplo n.º 18
0
        public StringContainer Base64Encode(StringContainer input)
        {
            var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(input.Text);

            return(new StringContainer {
                Text = System.Convert.ToBase64String(plainTextBytes)
            });
        }
Exemplo n.º 19
0
        public void TestOneChildWithGrandson()
        {
            var container = StringContainer.Get("(id(name))");

            Assert.AreEqual(container.Children[0].Data, "id");
            Assert.AreEqual(container.Children[0].Children[0].Data, "name");
            Assert.IsNull(container.Children[0].Children[0].Children);
        }
Exemplo n.º 20
0
        public void TestAddingTheEmptyString()
        {
            // expect the exception of the exception System.Diagnostics.Contracts.__ContractsRuntime+ContractException
            StringContainer sc  = new StringContainer();
            string          str = null;

            sc.AddString(str);
        }
Exemplo n.º 21
0
    public static void Main(string[] args)
    {
        object container = new StringContainer(args[0]);

        if (container is StringContainer)
        {
            Console.WriteLine((container as StringContainer).Contents);
        }
    }
Exemplo n.º 22
0
        public StringContainer GetSpecificMovieInfo()
        {
            StringContainer answer = new StringContainer()
            {
                str = Program.Classes.database.PrintSpecificMovie(1)
            };

            return(answer);
        }
Exemplo n.º 23
0
 /// <summary>
 /// Initializes a new <see cref="IndexEntry"/> using the supplied object entry, file name, and tag hierarchy.
 /// </summary>
 /// <param name="objectEntry">The object entry for this index entry.</param>
 /// <param name="filename">The file path of this index entry.</param>
 /// <param name="tagHierarchy">The tag hierarchy for this index entry.</param>
 public IndexEntry(ObjectEntry objectEntry, string filename, TagHierarchy tagHierarchy)
 {
     //Setup
     this.tagHierarchy = tagHierarchy;
     this.objectEntry  = objectEntry;
     Filename          = filename;
     Raws    = new RawContainer();
     Strings = new StringContainer();
 }
Exemplo n.º 24
0
        static void Main(string[] args)
        {
            string str       = "(id,created,employee(id,firstname,employeeType(id), lastname),location(id,lat,long),something,anything)";
            var    container = StringContainer.Get(str);

            container.Sort();
            System.Console.WriteLine(container.ToDeepString());
            System.Console.ReadKey();
        }
Exemplo n.º 25
0
    static public void Main()
    {
        // Declare the StringContainer class and add some strings
        StringContainer container = new StringContainer();

        container.AddString("This");
        container.AddString("is");
        container.AddString("a");
        container.AddString("multicast");
        container.AddString("delegate");
        container.AddString("example");

        // Create two delegates individually using different methods.
        StringContainer.CheckAndDisplayDelegate conStart   = StringExtensions.ConStart;
        StringContainer.CheckAndDisplayDelegate vowelStart = StringExtensions.VowelStart;

        // Get the list of all delegates assigned to this MulticastDelegate instance.
        Delegate[] delegateList = conStart.GetInvocationList();
        Console.WriteLine("conStart contains {0} delegate(s).", delegateList.Length);
        delegateList = vowelStart.GetInvocationList();
        Console.WriteLine("vowelStart contains {0} delegate(s).\n", delegateList.Length);

        // Determine whether the delegates are System.Multicast delegates.
        if (conStart is System.MulticastDelegate && vowelStart is System.MulticastDelegate)
        {
            Console.WriteLine("conStart and vowelStart are derived from MulticastDelegate.\n");
        }

        // Execute the two delegates.
        Console.WriteLine("Executing the conStart delegate:");
        container.DisplayAllQualified(conStart);
        Console.WriteLine();
        Console.WriteLine("Executing the vowelStart delegate:");
        container.DisplayAllQualified(vowelStart);
        Console.WriteLine();

        // Create a new MulticastDelegate and call Combine to add two delegates.
        StringContainer.CheckAndDisplayDelegate multipleDelegates =
            (StringContainer.CheckAndDisplayDelegate)Delegate.Combine(conStart, vowelStart);

        // How many delegates does multipleDelegates contain?
        delegateList = multipleDelegates.GetInvocationList();
        Console.WriteLine("\nmultipleDelegates contains {0} delegates.\n",
                          delegateList.Length);

        // Pass this multicast delegate to DisplayAllQualified.
        Console.WriteLine("Executing the multipleDelegate delegate.");
        container.DisplayAllQualified(multipleDelegates);

        // Call remove and combine to change the contained delegates.
        multipleDelegates = (StringContainer.CheckAndDisplayDelegate)Delegate.Remove(multipleDelegates, vowelStart);
        multipleDelegates = (StringContainer.CheckAndDisplayDelegate)Delegate.Combine(multipleDelegates, conStart);

        // Pass multipleDelegates to DisplayAllQualified again.
        Console.WriteLine("\nExecuting the multipleDelegate delegate with two conStart delegates:");
        container.DisplayAllQualified(multipleDelegates);
    }
Exemplo n.º 26
0
        public void TestTwoChildren()
        {
            var container = StringContainer.Get("(id,data)");

            Assert.AreEqual(container.Children[0].Data, "id");
            Assert.IsNull(container.Children[0].Children);
            Assert.AreEqual(container.Children[1].Data, "data");
            Assert.IsNull(container.Children[1].Children);
        }
Exemplo n.º 27
0
        public void TestAddingTheElement()
        {
            StringContainer sc = new StringContainer();

            sc.AddString("Jajs");
            sc.AddString("kolen");
            var res      = sc.ShowResult();
            var expected = "J k ";

            Assert.AreEqual(expected, res);
        }
Exemplo n.º 28
0
        public void NonBlittableStructWithFree()
        {
            var stringContainer = new StringContainer
            {
                str1 = "Foo",
                str2 = "Bar"
            };

            NativeExportsNE.DeepDuplicateStrings(stringContainer, out var stringContainer2);

            Assert.Equal(stringContainer, stringContainer2);
        }
Exemplo n.º 29
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        GUI.enabled = Application.isPlaying;

        StringContainer m_Target = target as StringContainer;

        if (GUILayout.Button("Update Changes"))
        {
            m_Target.OnValueChanged.Invoke(m_Target);
        }
    }
Exemplo n.º 30
0
        public void TestThirdChildWithGrandson()
        {
            var container = StringContainer.Get("(data,id,you(name))");

            Assert.AreEqual(container.Children[0].Data, "data");
            Assert.IsNull(container.Children[0].Children);

            Assert.AreEqual(container.Children[1].Data, "id");
            Assert.IsNull(container.Children[1].Children);

            Assert.AreEqual(container.Children[2].Data, "you");
            Assert.AreEqual(container.Children[2].Children[0].Data, "name");
            Assert.IsNull(container.Children[2].Children[0].Children);
        }
Exemplo n.º 31
0
 private void Plugins_Load(object sender, EventArgs e)
 {
     foreach (XElement pluginElement in Program.Settings.Root
         .Element("plugins")
         .Elements("plugin"))
     {
         StringContainer<XElement> element = new StringContainer<XElement>(
             pluginElement,
             String.Format("{0} by {1}",
                 pluginElement.Attribute("name").Value,
                 pluginElement.Attribute("author").Value));
         checkedListBox.Items.Add(element, pluginElement
             .Element("enabled")
             .Value.ToLower() == "true");
     }
     checkedListBox.Focus();
     loadingForm = false;
 }