Example #1
0
        public static async Task FetchProgramList()
        {
            try
            {
                StringBuilder stringBuilder = new StringBuilder();
                ObjectHolder.ProgramList = new CgApiProgramList();
                await ObjectHolder.ProgramList.Fetch();

                List <CgApiProgram> .Enumerator var_2 = ObjectHolder.ProgramList.get_Items().GetEnumerator();
                try
                {
                    while (var_2.MoveNext())
                    {
                        CgApiProgram expr_A2 = var_2.Current;
                        stringBuilder.AppendLine(string.Format("{0};{1};{2}", expr_A2.get_Id().ToString(), expr_A2.get_ExeName(), expr_A2.get_RegName()));
                    }
                }
                finally
                {
                    int num;
                    if (num < 0)
                    {
                        var_2.Dispose();
                    }
                }
                File.WriteAllText(Path.Combine(HelperFunctions.GetUserDataAppPath("CyberGhost", true), "programs"), CgApiHelper.Base64Encode(stringBuilder.ToString()));
                stringBuilder = null;
            }
            catch (Exception var_8_130)
            {
                HelperFunctions.DebugLine(string.Format("CgApiHelper::{0} COULD NOT FETCH PROGRAM {1}", MethodBase.GetCurrentMethod().Name, var_8_130.Message));
            }
        }
 private void SendCustomProgramInfoToApi(ProgramData progData)
 {
     AnonymousDownloading.< > c__DisplayClass30_0 expr_05 = new AnonymousDownloading.< > c__DisplayClass30_0();
     expr_05.< > 4__this = this;
     expr_05.progData    = progData;
     new Task(delegate
     {
         try
         {
             CgApiProgram expr_05 = new CgApiProgram();
             expr_05.set_ExeName(expr_05.progData.ExeName);
             expr_05.set_RegName(expr_05.progData.RegName);
             expr_05.PostProgramInfo().ConfigureAwait(false);
         }
         catch (Exception ex)
         {
             McExceptionLogItem expr_3B = new McExceptionLogItem();
             expr_3B.set_RelatingException(ex);
             expr_3B.set_ExceptionMessage("Failed to trigger Post Program Info" + ex.Message);
             McExceptionLogItem aEvent = expr_3B;
             ObjectHolder.EventLogger.LogLocalEvent(aEvent);
             CgApiProgram expr_05;
             HelperFunctions.DebugLine(string.Format("{0}::{1} PostProgramInfo FAILED {2}", expr_05.< > 4__this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message));
         }
     }).Start();
 private void SendCustomProgramInfoToApi()
 {
     new Task(delegate
     {
         try
         {
             foreach (ProgramData current in this.ProgramDataList)
             {
                 if (current.Visible)
                 {
                     CgApiProgram expr_23 = new CgApiProgram();
                     expr_23.set_ExeName(current.ExeName);
                     expr_23.set_RegName(current.RegName);
                     expr_23.PostProgramInfo().ConfigureAwait(false);
                 }
             }
         }
         catch (Exception ex)
         {
             McExceptionLogItem expr_63 = new McExceptionLogItem();
             expr_63.set_RelatingException(ex);
             expr_63.set_ExceptionMessage("Failed to trigger Post Program Info" + ex.Message);
             McExceptionLogItem aEvent = expr_63;
             ObjectHolder.EventLogger.LogLocalEvent(aEvent);
             HelperFunctions.DebugLine(string.Format("{0}::{1} PostProgramInfo FAILED {2}", base.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message));
         }
     }).Start();
 }
Example #4
0
        public ProgramData(CgApiProgram program, bool visible = false)
        {
            string uriString = this.IconFromFilePath(program.GetApplicationExe());

            this.ExeImage       = new Uri(uriString);
            this.ExeName        = program.GetApplicationDescription();
            this.ToolTip        = program.get_ExeName();
            this.ApplicationExe = program.GetApplicationExe();
            this.Visible        = visible;
        }
Example #5
0
 public static async Task LoadProgramsFromCsv()
 {
     try
     {
         string path = Path.Combine(HelperFunctions.GetUserDataAppPath("CyberGhost", true), "programs");
         if (!File.Exists(path))
         {
             await CgApiHelper.FetchProgramList();
         }
         string[] arg_CE_0 = CgApiHelper.Base64Decode(File.ReadAllText(path)).Split(new char[]
         {
             '\n'
         });
         ObjectHolder.ProgramList = new CgApiProgramList();
         ObjectHolder.ProgramList.get_Items().Clear();
         for (int var_3_D0 = 0; var_3_D0 < arg_CE_0.Length; var_3_D0++)
         {
             string var_4_D6 = arg_CE_0[var_3_D0];
             if (!string.IsNullOrEmpty(var_4_D6))
             {
                 string[] var_5_F3 = var_4_D6.Split(new char[]
                 {
                     ';'
                 });
                 CgApiProgram expr_FA = new CgApiProgram();
                 expr_FA.set_Id(int.Parse(var_5_F3[0]));
                 expr_FA.set_ExeName(var_5_F3[1]);
                 expr_FA.set_RegName(var_5_F3[2]);
                 ObjectHolder.ProgramList.get_Items().Add(expr_FA);
             }
         }
         path = null;
     }
     catch (Exception var_7_143)
     {
         HelperFunctions.DebugLine(string.Format("CgApiHelper::{0} COULD NOT LOAD PROGS FROM CSV {1}", MethodBase.GetCurrentMethod().Name, var_7_143.Message));
     }
 }