예제 #1
0
        public void getStockFile()
        {
            ReadSettings rs = new ReadSettings();

            //download the csv file and save it in the DATA folder
            //s = symbol
            //p = previous close
            //v = volume
            //a2 = avg daily volume
            //c = change and percent change
            Settings      smo        = Settings.instance;
            List <String> stockList  = smo.stocks;
            String        URL        = "http://download.finance.yahoo.com/d/quotes.csv?s=YHOO+GOOG+MSFT+TSLA&f=spva2c";
            String        URLModular = "http://download.finance.yahoo.com/d/quotes.csv?s=";
            String        attributes = "&f=spva2c";

            for (int i = 0; i < stockList.Count; i++)
            {
                URLModular = URLModular + "+" + stockList[i];
            }
            URLModular = URLModular + attributes;
            WebClient n = new WebClient();

            n.DownloadStringCompleted += new DownloadStringCompletedEventHandler(getNData);
            //dleete the old file
            try
            {
                n.DownloadStringAsync(new Uri(URLModular), data);
            }
            catch (Exception e)
            {
                throw e;
            }
            //place the new stockInfo in the data folder
        }
예제 #2
0
        public JsonObjectCreator(string regClass)
        {
            TkDebug.AssertArgumentNullOrEmpty(regClass, "regClass", null);

            fRegClass     = regClass;
            fReadSettings = ObjectUtil.ReadSettings;
        }
예제 #3
0
        public void LoadInvalidModelWithJsonFix()
        {
            // try to load an invalid gltf with an empty array

            var path = System.IO.Path.Combine(TestContext.CurrentContext.TestDirectory, "Assets\\SpecialCases\\Invalid_EmptyArray.gltf");

            Assert.Throws <Validation.SchemaException>(() => ModelRoot.Load(path));

            // try to load an invalid gltf with an empty array, using a hook to fix the json before running the parser.

            var rsettings = new ReadSettings();

            rsettings.JsonPreprocessor = _RemoveEmptyArrayJsonProcessor;

            var model = ModelRoot.Load(path, rsettings);

            Assert.NotNull(model);

            // save the model, using a hook to modify the json before writing it to the file.

            var wsettings = new WriteSettings();

            wsettings.JsonPostprocessor = json =>
            {
                json = json.Replace("glTF 2.0 Validator test suite", "postprocessed json"); return(json);
            };

            path = model.AttachToCurrentTest("modified.gltf", wsettings);

            model = ModelRoot.Load(path);

            Assert.AreEqual(model.Asset.Generator, "postprocessed json");
        }
예제 #4
0
 public static ModelRoot LoadGltf2(string zipPath, ReadSettings settings = null)
 {
     using (var zip = new ZipReader(zipPath))
     {
         return(zip.LoadGltf2(settings));
     }
 }
예제 #5
0
        public ModelRoot LoadModel(string gltfFile, ReadSettings settings = null)
        {
            var context = ReadContext
                          .Create(_ReadAsset)
                          .WithSettingsFrom(settings);

            return(context.ReadSchema2(gltfFile));
        }
예제 #6
0
 protected override object InternalConvertFromString(string text, ReadSettings settings)
 {
     if (string.Compare(text, "utf-8", StringComparison.OrdinalIgnoreCase) == 0)
     {
         return(ToolkitConst.UTF8);
     }
     return(Encoding.GetEncoding(text));
 }
예제 #7
0
 public GltfSharpReader(AssetReader assetReader, bool skipValidation = true)
 {
     _readSettings = new ReadSettings
     {
         FileReader     = assetReader,
         SkipValidation = skipValidation
     };
 }
예제 #8
0
 public object ConvertFromString(string text, ReadSettings settings)
 {
     if (string.Compare(text, "Y", StringComparison.OrdinalIgnoreCase) == 0)
     {
         return(true);
     }
     return(false);
 }
예제 #9
0
        protected override object InternalConvertFromString(string text, ReadSettings settings)
        {
            if (string.IsNullOrEmpty(text))
            {
                return(null);
            }

            return(QName.GetFullName(text));
        }
예제 #10
0
 public EFiller(string ipFile, string opFile, string year)
 {
     this.year           = year;
     this.inputDataFile  = ipFile;
     this.outputDataFile = opFile;
     fillingStatus       = new List <EfillingDetails>();
     driver     = DriverFactory.getDriver();
     driver.Url = ReadSettings.GetuRL();
 }
예제 #11
0
        protected override object InternalConvertFromString(string text, ReadSettings settings)
        {
            double result;

            if (double.TryParse(text, Styles, ObjectUtil.SysCulture, out result))
            {
                return(result);
            }
            return(Convert.ToDouble(text, ObjectUtil.SysCulture));
        }
예제 #12
0
 public object ConvertFromString(string text, ReadSettings settings)
 {
     try
     {
         return(Convert.FromBase64String(text));
     }
     catch
     {
         return(null);
     }
 }
예제 #13
0
 public object ConvertFromString(string text, ReadSettings settings)
 {
     try
     {
         int value = int.Parse(text, ObjectUtil.SysCulture);
         return(WeUtil.ToDateTime(value));
     }
     catch
     {
         return(DateTime.Now);
     }
 }
 public object ConvertFromString(string text, ReadSettings settings)
 {
     try
     {
         int value = int.Parse(text, ObjectUtil.SysCulture);
         return WeUtil.ToDateTime(value);
     }
     catch
     {
         return DateTime.Now;
     }
 }
예제 #15
0
 public object ConvertFromString(string text, ReadSettings settings)
 {
     int value = text.Value<int>();
     switch (value)
     {
         case 0:
             return ProductStatusType.On;
         case 1:
             return ProductStatusType.Down;
         default:
             return ProductStatusType.On;
     }
 }
예제 #16
0
        protected override object InternalConvertFromString(string text, ReadSettings settings)
        {
            if (string.IsNullOrEmpty(text))
            {
                return(default(DateTime));
            }
            if (text.Length == settings.DateTimeFormat.Length)
            {
                return(DateTime.ParseExact(text, settings.DateTimeFormat, ObjectUtil.SysCulture));
            }

            return(DateTime.Parse(text, ObjectUtil.SysCulture));
        }
        protected override object InternalConvertFromString(string text, ReadSettings settings)
        {
            if (string.IsNullOrEmpty(text))
            {
                return(null);
            }
            string[] arr    = text.Split('|');
            var      result = (from item in arr
                               where !string.IsNullOrEmpty(item)
                               select item).Distinct();

            return(new ObjectOperatorCollection(result));
        }
예제 #18
0
 public virtual object ConvertFromString(string text, ReadSettings settings)
 {
     IsSuccess = true;
     try
     {
         return(InternalConvertFromString(text, settings));
     }
     catch
     {
         IsSuccess = false;
         return(default(T));
     }
 }
예제 #19
0
        public object ConvertFromString(string text, ReadSettings settings)
        {
            switch (text)
            {
            case "0":
                return(false);

            case "1":
                return(true);

            default:
                return(false);
            }
        }
예제 #20
0
        public void getWeatherJSON()
        {
            // read settings and get info from settings class
            ReadSettings rs   = new ReadSettings();
            Settings     smo  = Settings.instance;
            string       city = smo.city;



            //the next five lines download and save the weather data for the given city (first the current data
            //then the forecasted data)
            WebClient n = new WebClient();
            WebClient m = new WebClient();

            n.DownloadStringCompleted += new DownloadStringCompletedEventHandler(getNString);
            m.DownloadStringCompleted += new DownloadStringCompletedEventHandler(getMString);
            String jsData         = "";
            String jsDataForecast = "";

            try
            {
                if (smo.city == "Alexandria")
                {
                    n.DownloadStringAsync(new System.Uri("http://api.openweathermap.org/data/2.5/weather?id=361058&appid=30b0e4a13dcb98a91143652520f8f108"), jsData);
                    m.DownloadStringAsync(new System.Uri("http://api.openweathermap.org/data/2.5/forecast?id=361058&appid=30b0e4a13dcb98a91143652520f8f108"), jsDataForecast);
                }
                else if (smo.city == "Kuwait")
                {
                    n.DownloadStringAsync(new System.Uri("http://api.openweathermap.org/data/2.5/weather?id=285787&appid=30b0e4a13dcb98a91143652520f8f108"), jsData);
                    m.DownloadStringAsync(new System.Uri("http://api.openweathermap.org/data/2.5/forecast?id=285787&appid=30b0e4a13dcb98a91143652520f8f108"), jsDataForecast);
                }
                else if (smo.city == "London")
                {
                    n.DownloadStringAsync(new System.Uri("http://api.openweathermap.org/data/2.5/weather?id=2643743&appid=30b0e4a13dcb98a91143652520f8f108"), jsData);
                    m.DownloadStringAsync(new System.Uri("http://api.openweathermap.org/data/2.5/forecast?id=2643743&appid=30b0e4a13dcb98a91143652520f8f108"), jsDataForecast);
                }
                else if (smo.city == "Montreal")
                {
                    n.DownloadStringAsync(new System.Uri("http://api.openweathermap.org/data/2.5/weather?id=6077243&appid=30b0e4a13dcb98a91143652520f8f108"), jsData);
                    m.DownloadStringAsync(new System.Uri("http://api.openweathermap.org/data/2.5/forecast?id=6077243&appid=30b0e4a13dcb98a91143652520f8f108"), jsDataForecast);
                }
            }
            catch (Exception)
            {
            }


            //now we will have to create c# weatherDay classes with the selected attributes
        }
예제 #21
0
        protected override object InternalConvertFromString(string text, ReadSettings settings)
        {
            ISupportDbContext support = BaseAppSetting.Current as ISupportDbContext;

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

            if (string.IsNullOrEmpty(text))
            {
                return(support.Default);
            }
            return(support.GetContextConfig(text));
        }
예제 #22
0
 protected override object InternalConvertFromString(string text, ReadSettings settings)
 {
     if (Styles.Contains(text.ToUpperInvariant()))
     {
         return(PageStyleClass.FromPageStyle(ObjectUtil.ParseEnum <PageStyle>(text, true)));
     }
     else if (text.StartsWith("C", StringComparison.OrdinalIgnoreCase))
     {
         return(PageStyleClass.FromString(text.Substring(1)));
     }
     else
     {
         return(PageStyleClass.FromString(text));
     }
 }
예제 #23
0
        public void StartProcess()
        {
            SelectedIndex = 1;
            CB.Content    = "< Back";
            CB.IsEnabled  = false;
            var settings = new ReadSettings();
            ConnectionSettings conSettings = new ReadSettings().Get();

            settings.Reload();

            SetSource            = conSettings.Source;
            SetDatabase          = conSettings.Database;
            SetUser              = conSettings.User;
            SetPassword          = conSettings.Password;
            SetTrustedConnection = conSettings.TrustedConnection;
        }
예제 #24
0
        public object ConvertFromString(string text, ReadSettings settings)
        {
            if (string.IsNullOrEmpty(text))
            {
                return(null);
            }

            object         result = fConverter.ConvertFromString(text, settings);
            IConvertStatus status = fConverter as IConvertStatus;

            if (status != null && !status.IsSuccess)
            {
                return(null);
            }
            return(result);
        }
예제 #25
0
        public object ConvertFromString(string text, ReadSettings settings)
        {
            int value = text.Value <int>();

            switch (value)
            {
            case 0:
                return(ProductStatus.On);

            case 1:
                return(ProductStatus.Down);

            default:
                return(ProductStatus.On);
            }
        }
예제 #26
0
        private ModelRoot _LoadGltf2(string gltfFile, ReadSettings settings = null)
        {
            var context = ReadContext
                          .Create(_ReadAsset)
                          .WithSettingsFrom(settings);

            using (var m = new System.IO.MemoryStream())
            {
                using (var s = _Archive.GetEntry(gltfFile).Open())
                {
                    s.CopyTo(m);
                }

                m.Position = 0;

                return(context.ReadSchema2(m));
            }
        }
예제 #27
0
        protected override object InternalConvertFromString(string text, ReadSettings settings)
        {
            if (text == null)
            {
                return(0);
            }
            if (text.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
            {
                return(Convert.ToInt32(text, 16));
            }
            int result;

            if (int.TryParse(text, DoubleConverter.Styles, ObjectUtil.SysCulture, out result))
            {
                return(result);
            }
            return(Convert.ToInt32(text, ObjectUtil.SysCulture));
        }
        protected override object InternalConvertFromString(string text, ReadSettings settings)
        {
            try
            {
                if (string.IsNullOrEmpty(text))
                {
                    return(null);
                }

                text = text.Replace(',', ' ');
                string[] data = text.Split((char[])null, StringSplitOptions.RemoveEmptyEntries);
                HashSet <PageStyleClass> result = new HashSet <PageStyleClass>(
                    from item in data select item.Trim().Value <PageStyleClass>());
                return(result);
            }
            catch
            {
                return(null);
            }
        }
예제 #29
0
        public void DoLogin()
        {
            IList <UserLogin> users         = IExcelReader.ReadExcelData(inputDataFile);
            LoginPage         UserLoginPage = new LoginPage(driver);
            string            listofmsg     = "";

            foreach (UserLogin user in users)
            {
                try {
                    var loginInfoText = UserLoginPage.SetLoginData(user.userName, user.passWord);
                    if (loginInfoText.Contains("User Does not Exists"))
                    {
                        fillingStatus.Add(new EfillingDetails(user, "INVALID LOGIN", ""));
                        continue;
                    }
                    else if (loginInfoText.ToLower().Contains("register your mobile"))
                    {
                        listofmsg = DoNavigationForMobileVerificationCust();
                    }
                    else
                    {
                        listofmsg = DoAllNavigationtoPrint();
                    }
                    if (listofmsg.Length > 0)
                    {
                        fillingStatus.Add(new EfillingDetails(user, "LOGIN SUCCESS", "Initiated", listofmsg));
                    }
                    else
                    {
                        fillingStatus.Add(new EfillingDetails(user, "LOGIN SUCCESS", "No Initiated", ""));
                    }
                }catch (Exception e) {
                    driver.Url = ReadSettings.GetuRL();
                    fillingStatus.Add(new EfillingDetails(user, "Error occured", "Error", "Error in processing" + e.Message));
                }
            }

            WriteToFile();
            KillChrome();
        }
예제 #30
0
        public static SceneBuilder Load(string filePath, ReadSettings settings = null)
        {
            var mdl = ModelRoot.Load(filePath, settings);

            return(mdl.DefaultScene.ToSceneBuilder());
        }
예제 #31
0
 public object ConvertFromString(string text, ReadSettings settings)
 {
     return(ColorTranslator.FromHtml(text));
 }
 public object ConvertFromString(string text, ReadSettings settings)
 {
     if (string.Compare(text, "Y", StringComparison.OrdinalIgnoreCase) == 0)
         return true;
     return false;
 }
예제 #33
0
 public object ConvertFromString(string text, ReadSettings settings)
 {
     return ColorTranslator.FromHtml(text);
 }
예제 #34
0
 protected override object InternalConvertFromString(string text, ReadSettings settings)
 {
     return(text);
 }
예제 #35
0
 public object ConvertFromString(string text, ReadSettings settings)
 {
     return null;
 }