Ejemplo n.º 1
0
 public static async Task LoadHintsFromCsv()
 {
     try
     {
         string path = Path.Combine(HelperFunctions.GetUserDataAppPath("CyberGhost", true), "hint");
         if (!File.Exists(path))
         {
             await CgApiHelper.FetchRandomHintS();
         }
         string[] arg_CE_0 = CgApiHelper.Base64Decode(File.ReadAllText(path)).Split(new char[]
         {
             '\n'
         });
         ObjectHolder.HintList = new CgApiHintList();
         ObjectHolder.HintList.get_Items().Clear();
         for (int var_3_D0 = 0; var_3_D0 < arg_CE_0.Length; var_3_D0++)
         {
             string var_4_D9 = arg_CE_0[var_3_D0];
             if (!string.IsNullOrEmpty(var_4_D9))
             {
                 string[] var_5_F9 = var_4_D9.Split(new char[]
                 {
                     ';'
                 });
                 CgApiHint expr_100 = new CgApiHint();
                 expr_100.set_Id(int.Parse(var_5_F9[0]));
                 CgApiDisplaynameLocalization expr_115 = new CgApiDisplaynameLocalization();
                 expr_115.set_DefaultString(var_5_F9[2]);
                 expr_115.set_Strings(new Dictionary <string, string>());
                 expr_100.set_Description(expr_115);
                 expr_100.get_Description().get_Strings()["de"] = var_5_F9[1];
                 expr_100.get_Description().get_Strings()["en"] = var_5_F9[2];
                 expr_100.get_Description().get_Strings()["es"] = var_5_F9[3];
                 expr_100.get_Description().get_Strings()["fr"] = var_5_F9[4];
                 expr_100.get_Description().get_Strings()["it"] = var_5_F9[5];
                 expr_100.get_Description().get_Strings()["pl"] = var_5_F9[6];
                 expr_100.get_Description().get_Strings()["ro"] = var_5_F9[7];
                 expr_100.get_Description().get_Strings()["ru"] = var_5_F9[8];
                 expr_100.set_Profile(var_5_F9[9]);
                 ObjectHolder.HintList.get_Items().Add(expr_100);
             }
         }
         path = null;
     }
     catch (Exception var_7_234)
     {
         HelperFunctions.DebugLine(string.Format("CgiApiHelper::{0} COULD NOT LOAD HINT FROM CSV {1}", MethodBase.GetCurrentMethod().Name, var_7_234.Message));
     }
 }
Ejemplo n.º 2
0
        public static async Task FetchRandomHintS()
        {
            try
            {
                StringBuilder stringBuilder = new StringBuilder();
                ObjectHolder.HintList = new CgApiHintList();
                await ObjectHolder.HintList.Fetch();

                List <CgApiHint> .Enumerator var_2 = ObjectHolder.HintList.get_Items().GetEnumerator();
                try
                {
                    while (var_2.MoveNext())
                    {
                        CgApiHint var_3_A5   = var_2.Current;
                        object    var_4_B1   = var_3_A5.get_Description().get_DefaultString();
                        object    var_5_BE   = var_3_A5.get_Description().get_DefaultString();
                        object    var_6_CB   = var_3_A5.get_Description().get_DefaultString();
                        object    var_7_D8   = var_3_A5.get_Description().get_DefaultString();
                        object    var_8_E5   = var_3_A5.get_Description().get_DefaultString();
                        object    var_9_F2   = var_3_A5.get_Description().get_DefaultString();
                        object    var_10_FF  = var_3_A5.get_Description().get_DefaultString();
                        object    var_11_10C = var_3_A5.get_Description().get_DefaultString();
                        object    var_12_114 = var_3_A5.get_Profile();
                        if (var_3_A5.get_Description().get_Strings().ContainsKey("de"))
                        {
                            var_4_B1 = var_3_A5.get_Description().get_Strings()["de"];
                        }
                        if (var_3_A5.get_Description().get_Strings().ContainsKey("en"))
                        {
                            var_5_BE = var_3_A5.get_Description().get_Strings()["en"];
                        }
                        if (var_3_A5.get_Description().get_Strings().ContainsKey("es"))
                        {
                            var_6_CB = var_3_A5.get_Description().get_Strings()["es"];
                        }
                        if (var_3_A5.get_Description().get_Strings().ContainsKey("fr"))
                        {
                            var_7_D8 = var_3_A5.get_Description().get_Strings()["fr"];
                        }
                        if (var_3_A5.get_Description().get_Strings().ContainsKey("it"))
                        {
                            var_8_E5 = var_3_A5.get_Description().get_Strings()["it"];
                        }
                        if (var_3_A5.get_Description().get_Strings().ContainsKey("pl"))
                        {
                            var_9_F2 = var_3_A5.get_Description().get_Strings()["pl"];
                        }
                        if (var_3_A5.get_Description().get_Strings().ContainsKey("ro"))
                        {
                            var_11_10C = var_3_A5.get_Description().get_Strings()["ro"];
                        }
                        if (var_3_A5.get_Description().get_Strings().ContainsKey("ru"))
                        {
                            var_10_FF = var_3_A5.get_Description().get_Strings()["ru"];
                        }
                        stringBuilder.AppendLine(string.Format("{0};{1};{2};{3};{4};{5};{6};{7};{8};{9}", new object[]
                        {
                            var_3_A5.get_Id(),
                            var_4_B1,
                            var_5_BE,
                            var_6_CB,
                            var_7_D8,
                            var_8_E5,
                            var_9_F2,
                            var_11_10C,
                            var_10_FF,
                            var_12_114
                        }));
                    }
                }
                finally
                {
                    int num;
                    if (num < 0)
                    {
                        var_2.Dispose();
                    }
                }
                File.WriteAllText(Path.Combine(HelperFunctions.GetUserDataAppPath("CyberGhost", true), "hint"), CgApiHelper.Base64Encode(stringBuilder.ToString()));
                stringBuilder = null;
            }
            catch (Exception var_14_336)
            {
                HelperFunctions.DebugLine(string.Format("CgiApiHelper::{0} COULD NOT FETCH RANDOM HINT {1}", MethodBase.GetCurrentMethod().Name, var_14_336.Message));
            }
        }