예제 #1
0
        public void GetDataStorage()
        {
            DataStorage ds;

            string result = dsMgr.FindDataStorage(out ds);

            if (result != null)
            {
                W.WriteLineAligned($"DataStorages found|\n", result);
            }
            else
            {
                W.WriteLineAligned($"DataStorages not found|", result);
            }

            IList <Schema> schemas = GetSchemas();

            W.WriteAligned("\n");
            W.WriteAligned($"List of schema|");

            if (schemas != null)
            {
                W.WriteLineMsg($"found| {schemas.Count}");

                foreach (Schema s in schemas)
                {
                    W.WriteLineAligned($"schema|", $"name| {s.SchemaName.PadRight(35)}  vendor id| {s.VendorId.PadRight(20)}   guid| {s.GUID.ToString()}");
                }
            }
            else
            {
                W.WriteLineAligned($"none found");
            }

            W.ShowMsg();
        }
예제 #2
0
        public void ShowSchemas(IList <Schema> schemas)
        {
            if (schemas != null && schemas.Count > 0)
            {
                W.WriteLineAligned($"schema not found| {(schemas?.Count.ToString() ?? "is null")}");
            }

            foreach (Schema s in schemas)
            {
                W.WriteLineAligned($"schema|", $"name| {s.SchemaName.PadRight(35)}  vendor id| {s.VendorId.PadRight(20)}   guid| {s.GUID.ToString()}");
            }

            W.ShowMsg();
        }
예제 #3
0
        public void testNames()
        {
            string test;
            string testA;
            string testB;

            SchemaBuilder sb = new SchemaBuilder(Guid.NewGuid());

            // failed - the "." is no good
            testA = Util.GetVendorId();

            w.WriteLineAligned($"is ok?| {testA}| ", $"{sb.AcceptableName(testA)}");

            // worked
            testA = Util.GetVendorId().Replace(".", "_");

            w.WriteLineAligned($"is ok?| {testA}| ", $"{sb.AcceptableName(testA)}");

            // this worked (but see below)
            testB = AppRibbon.Doc.Title;
            test  = (testA + "_" + testB);

            w.WriteLineAligned($"is ok?| {test}| ", $"{sb.AcceptableName(test)}");

            // this worked (but see below)
            testB = AppRibbon.Doc.Title.Replace(' ', '_');
            test  = (testA + "_" + testB);

            w.WriteLineAligned($"is ok?| {test}| ", $"{sb.AcceptableName(test)}");

            // this worked (but see below)
            testB = AppRibbon.Doc.Title.Replace(" ", null);
            test  = (testA + "_" + testB);

            w.WriteLineAligned($"is ok?| {test}| ", $"{sb.AcceptableName(test)}");

            // this failed because the spaces are no-good
            // the above titles worked because the model's title already has no spaces
            testB = "this is a test";
            test  = (testA + "_" + testB);

            w.WriteLineAligned($"is ok?| {test}| ", $"{sb.AcceptableName(test)}");

            // worked (eliminated the spaces)
            testB = "this is a test".Replace(" ", null);
            test  = (testA + "_" + testB);

            w.WriteLineAligned($"is ok?| {test}| ", $"{sb.AcceptableName(test)}");

            // worked (eliminate the spaces)
            testB = "this is a test".Replace(" ", "");
            test  = (testA + "_" + testB);

            w.WriteLineAligned($"is ok?| {test}| ", $"{sb.AcceptableName(test)}");

            testB = "this is a test TEST+123-456&789 =0";
            testB = Regex.Replace(testB, @"[^0-9a-zA-Z]", "");
            test  = (testA + "_" + testB);

            w.WriteLineAligned($"is ok?| {test}| ", $"{sb.AcceptableName(test)}");


            w.ShowMsg();
        }