viewing paste Unknown #15776 | C#

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
using ClientSupport;
using FORCServerSupport;
using FrontierSupport;
using System;
using System.Windows.Forms;
 
namespace EliteLauncher
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
 
        FORCManager m_manager = new FORCManager();
        string m_actualVersion;
        string CobraBayVersion;
        ServerInterface.VersionStatus m_versionStatus;
        string m_serverClientVersion;
        bool m_wasAuthorised;
        NewsFeed m_newsfeed;
        string m_productDirectoryRoot;
 
 
        public NewsFeed News
        {
            get
            {
                return this.m_newsfeed;
            }
            set
            {
                if (value != this.m_newsfeed)
                {
                    this.m_newsfeed = value;
                    //this.RaisePropertyChanged("Newsfeed");
                }
            }
        }
 
        public string ProductDirectoryRoot
        {
            get
            {
                return this.m_productDirectoryRoot;
            }
            set
            {
                if (this.m_productDirectoryRoot != value)
                {
                    this.m_productDirectoryRoot = value;
                    //this.RaisePropertyChanged("ProductDirectoryRoot");
                }
            }
        }
 
 
        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                m_manager.Initialise(new FormsDirectorySelector());
                if (m_manager.ServerConnection == null)
                {
                    FORCServerConnection fORCServerConnection = new FORCServerConnection(m_manager);
                    m_manager.ServerConnection = fORCServerConnection;
                    if (!this.m_manager.HasServer)
                    {
                        return;
                    }
                }
                if (m_manager.MachineIdentifier == null)
                {
                    m_manager.MachineIdentifier = new FrontierMachineIdentifier();
                }
                m_actualVersion = m_manager.ActualVersion;
                CobraBayVersion = m_manager.ApplicationVersion;
                LogEntry logEntry = new LogEntry("ClientVersion");
                logEntry.AddValue("application", CobraBayVersion);
                if (CobraBayVersion != m_actualVersion)
                {
                    logEntry.AddValue("actual", m_actualVersion);
                }
                m_manager.ServerConnection.LogValues(m_manager.UserDetails, logEntry);
                JSONWebQuery.SetUserAgent("EDLaunch", CobraBayVersion, null);
                m_versionStatus = m_manager.ServerConnection.CheckClientVersion(CobraBayVersion, out m_serverClientVersion);
               // m_manager.UpdateProjectList();
                Update();
                //this.TidyOldConfigurations();
            }
            catch (Exception crap)
            {
                return;
            }
        }
 
        private Project GetSelectedProject()
        {
            Project[] projectArray = this.m_manager.AvailableProjects.GetProjectArray();
            string[] strArrays = new string[] { "FORC_FDEV_D_VIP_1001", "FORC_FDEV_D_PRESS_1001", "FORC-FDEV-D-1000", "FORC-FDEV-D-1001", "FORC-FDEV-D-1002" };
            string[] strArrays1 = strArrays;
            for (int i = 0; i < (int)strArrays1.Length; i++)
            {
                string str = strArrays1[i];
                Project[] projectArray1 = projectArray;
                for (int j = 0; j < (int)projectArray1.Length; j++)
                {
                    Project project = projectArray1[j];
                    if (project.Name == str)
                    {
                        return project;
                    }
                }
            }
            if ((int)projectArray.Length != 1)
            {
                return null;
            }
            return projectArray[0];
        }
 
        private void btnLogin_Click(object sender, EventArgs e)
        {
            m_manager.ResetLogin(true, true);
            m_manager.UserDetails.EmailAddress = "";
            m_manager.UserDetails.Password = "";
            //m_manager.UserDetails.TwoFactor = null;
            m_manager.Authenticate();
            return;
        }
 
 
        public void Debug(string text, params string[] reps)
        {
            for (int i = 0; i < reps.Length; i++)
            {
                text = text.Replace("{" + i + "}", reps[i]);
            }
            this.UIThread(() =>
            {
                //debugbox.Text += DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + " - " + text + Environment.NewLine;
                txtDebug.Text += text + Environment.NewLine;
                txtDebug.SelectionStart = txtDebug.Text.Length;
                txtDebug.ScrollToCaret();
                txtDebug.Refresh();
            });
        }
 
        private void Update()
        {
            LogEntry logEntry;
            //this.HideUnusedSeparators();
            if (this.News == null)
            {
                this.News = new NewsFeed(this.m_manager);
            }
            this.News.Update();
            this.ProductDirectoryRoot = this.m_manager.RootDirectory;
        }
 
 
    }
    public static class ControlExtensions
    {
        public static void UIThread(this Control @this, Action code)
        {
            if (null != @this && (!@this.Disposing || !@this.IsDisposed))
            {
                if (@this.InvokeRequired)
                {
                    @this.BeginInvoke(code);
                }
                else
                {
                    code.Invoke();
                }
            }
        }
    }
}
 
Viewed 610 times, submitted by Guest.