示例#1
0
        public NewArrayDlg()
        {
            InitializeComponent();
            ulong StartBytes = (ulong)System.GC.GetTotalMemory(true);

            Neuron[] n = new Neuron[sizeCount];
            for (int i = 0; i < sizeCount; i++)
            {
                n[i] = new Neuron(false);
            }
            ulong StopBytes   = (ulong)System.GC.GetTotalMemory(true);
            ulong neuronSize1 = (StopBytes - StartBytes) / sizeCount;

            ulong availablePhysicalMemory = new Microsoft.VisualBasic.Devices.ComputerInfo().AvailablePhysicalMemory;
            ulong totalPhysicalMemory     = new Microsoft.VisualBasic.Devices.ComputerInfo().TotalPhysicalMemory;
            long  memoryCurrentlyInUse    = GC.GetTotalMemory(true);
            //ulong neuronSize = approxNeuronSize + (approxSynapseSize * assumedSynapseCount);
            ulong neuronSize = neuronSize1 + (approxSynapseSize * assumedSynapseCount);
            ulong maxNeurons = availablePhysicalMemory / neuronSize;

            string text = "";

            text          += "Total Pysical Memory: " + totalPhysicalMemory.ToString("##,#") + crlf;
            text          += "Available Physical Memory: " + availablePhysicalMemory.ToString("##,#") + crlf;
            text          += "Max Neurons Possible in RAM: " + maxNeurons.ToString("##,#") + crlf;
            text          += "Assuming average " + assumedSynapseCount + " synapses per neuron" + crlf;
            textBlock.Text = text;
        }
示例#2
0
        public NewArrayDlg()
        {
            InitializeComponent();

            cbUseServers.IsChecked    = MainWindow.useServers;
            buttonSpeedTest.IsEnabled = MainWindow.useServers;
            buttonRefresh.IsEnabled   = MainWindow.useServers;
            //textBoxRows.Text = "1000";
            //textBoxColumns.Text = "1000";
            textBoxRows.Text    = "15";
            textBoxColumns.Text = "30";


            ulong StartBytes  = (ulong)System.GC.GetTotalMemory(true);
            ulong StopBytes   = (ulong)System.GC.GetTotalMemory(true);
            ulong neuronSize1 = (StopBytes - StartBytes) / sizeCount;

            ulong availablePhysicalMemory = new Microsoft.VisualBasic.Devices.ComputerInfo().AvailablePhysicalMemory;
            ulong totalPhysicalMemory     = new Microsoft.VisualBasic.Devices.ComputerInfo().TotalPhysicalMemory;
            long  memoryCurrentlyInUse    = GC.GetTotalMemory(true);
            //ulong neuronSize = approxNeuronSize + (approxSynapseSize * assumedSynapseCount);
            ulong neuronSize = neuronSize1 + (approxSynapseSize * assumedSynapseCount);
            ulong maxNeurons = availablePhysicalMemory / neuronSize;

            string text = "";

            text          += "Total Pysical Memory: " + totalPhysicalMemory.ToString("##,#") + crlf;
            text          += "Available Physical Memory: " + availablePhysicalMemory.ToString("##,#") + crlf;
            text          += "Max Neurons Possible in RAM: " + maxNeurons.ToString("##,#") + crlf;
            text          += "Assuming average " + assumedSynapseCount + " synapses per neuron" + crlf;
            textBlock.Text = text;

            UpdateServerTextBox();
        }
示例#3
0
        public NewArrayDlg()
        {
            InitializeComponent();
            bool previousShowSynapses = false;

            if (MainWindow.theNeuronArray != null)
            {
                previousShowSynapses = MainWindow.theNeuronArray.ShowSynapses;
            }

            cbUseServers.IsChecked    = MainWindow.useServers;
            buttonSpeedTest.IsEnabled = MainWindow.useServers;
            buttonRefresh.IsEnabled   = MainWindow.useServers;
            //textBoxRows.Text = "1000";
            //textBoxColumns.Text = "1000";
            textBoxRows.Text    = "15";
            textBoxColumns.Text = "30";

            ulong neuronSize1 = 55;

            ulong availablePhysicalMemory = new Microsoft.VisualBasic.Devices.ComputerInfo().AvailablePhysicalMemory;
            ulong totalPhysicalMemory     = new Microsoft.VisualBasic.Devices.ComputerInfo().TotalPhysicalMemory;
            long  memoryCurrentlyInUse    = GC.GetTotalMemory(true);
            //ulong neuronSize = approxNeuronSize + (approxSynapseSize * assumedSynapseCount);
            ulong neuronSize = neuronSize1 + (approxSynapseSize * assumedSynapseCount);

            maxNeurons = availablePhysicalMemory / neuronSize;

            string text = "";

            text          += "Total Memory: " + totalPhysicalMemory.ToString("##,#") + crlf;
            text          += "Available Memory: " + availablePhysicalMemory.ToString("##,#") + crlf;
            text          += "Max Neurons Possible: " + maxNeurons.ToString("##,#") + crlf;
            text          += "Assuming average " + assumedSynapseCount + " synapses per neuron" + crlf;
            textBlock.Text = text;

            previousUseNeurons     = MainWindow.useServers;
            cbUseServers.IsChecked = MainWindow.useServers;
            UpdateServerTextBox();
            textBoxColumns.Focus();
        }
        /// <summary>
        /// Gathers error information and shows the error window
        /// </summary>
        /// <param name="errorLocation">The location of where the erorr occurred</param>
        /// <param name="errorInfo">Information about the error</param>
        /// <param name="criticalError">If set to true, then the program closes after the error hhas been shown</param>        
        public void ErrorReporting(Exception ex, bool criticalError)
        {
            string clientVersion = null;
            ulong SystemMemory = 0;
            //error information
            try
            {
                if (_formError == null || _formError.IsDisposed)
                    _formError = new FormError();

                _formError.AddInfoLine("Error: " + ex.Message + Environment.NewLine);

                if(ex.InnerException != null)
                    _formError.AddInfoLine("InnerException: " + ex.InnerException.Message + Environment.NewLine);

                _formError.AddInfoLine("Error Occured at: " + Environment.NewLine + ex.StackTrace);

                _formError.AddInfoLine(Environment.NewLine + Environment.NewLine + "Extra error information.  {");
                foreach (DictionaryEntry de in ex.Data)
                {
                    _formError.AddInfoLine(string.Format("      {0} = {1}", de.Key, de.Value));
                }
                _formError.AddInfoLine("}");

                //system information
                _formError.AddInfoLine(Environment.NewLine + "System information.  {");

                if (System.Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE") != null)
                    _formError.AddInfoLine("PROCESSOR_ARCHITECTURE = " + System.Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE"));
                else
                    _formError.AddInfoLine("PROCESSOR_ARCHITECTURE returned null");

                try
                {
                    //_formError.AddInfoLine("System memory amount deteted = " + Microsoft.VisualBasic.Devices.ComputerInfo().TotalPhysicalMemory
                    SystemMemory = new Microsoft.VisualBasic.Devices.ComputerInfo().TotalPhysicalMemory;
                }
                catch(Exception exy){} //not interested in the error, so its just absorbed

                _formError.AddInfoLine("System memory ammount = " + SystemMemory.ToString());

                _formError.AddInfoLine("OS version: " + Environment.OSVersion);
                _formError.AddInfoLine("Environment version: " + Environment.Version.ToString());

                RegistryKey installed_versions = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\NET Framework Setup\NDP");
                string[] version_names = installed_versions.GetSubKeyNames();
                //version names start with 'v', eg, 'v3.5' which needs to be trimmed off before conversion
                double Framework = Convert.ToDouble(version_names[version_names.Length - 1].Remove(0, 1), CultureInfo.InvariantCulture);
                RegistryKey newestDotNetKey = installed_versions.OpenSubKey(version_names[version_names.Length - 1]);
                int SP = Convert.ToInt32(newestDotNetKey.GetValue("SP", 0));

                string tmpDotNETversionsString = "";
                foreach (string version in version_names)
                {
                    tmpDotNETversionsString += version + ", ";
                }
                tmpDotNETversionsString = tmpDotNETversionsString.Substring(0, tmpDotNETversionsString.Length - 2);

                _formError.AddInfoLine("Installed .NET versions: " + tmpDotNETversionsString);
                //_formError.AddInfoLine("Newest .NET version:  " + Framework + "  (SP: " + SP.ToString() + ")");

                string DotNetVersionLong = (string)newestDotNetKey.GetValue("Version", "");
                if (DotNetVersionLong == "")
                {
                    //assuming version 4 now
                    RegistryKey v4subkey = installed_versions.OpenSubKey("v4");
                    foreach (string subkey in v4subkey.GetSubKeyNames())
                    {
                        _formError.AddInfoLine(string.Format("Newest .NET version: {0}  ({1}) (SP: {2}", v4subkey.OpenSubKey(subkey).GetValue("Version", "x"), subkey, SP.ToString()));
                    }
                }
                else
                    _formError.AddInfoLine("Newest .NET version: " + Framework + "  (SP: " + SP.ToString() + ")");

                _formError.AddInfoLine("}");

                //basic information
                _formError.AddInfoLine(Environment.NewLine + "FormMain information.  {");
                //if(_formOptions != null)
                //    _formError.AddInfoLine("Client Version: " + _formOptions.GetClientVersion());
                //else
                //    _formError.AddInfoLine("Client Version: _formOptions is null");

                try
                {
                    Assembly ass = Assembly.GetExecutingAssembly();
                    if (ass != null)
                    {
                        FileVersionInfo FVI = FileVersionInfo.GetVersionInfo(ass.Location);
                        clientVersion = string.Format("{0}.{1}.{2}.{3}", FVI.FileMajorPart, FVI.FileMinorPart, FVI.FileBuildPart, FVI.FilePrivatePart);
                    }
                }
                catch (Exception exz){}

                if(clientVersion == null)
                    _formError.AddInfoLine("Client Version: clientVersion was null");
                else
                    _formError.AddInfoLine("Client Version: " + clientVersion);

                //System.Environment.GetEnvironmentVariable("ProgramFiles");

                _formError.AddInfoLine("_TweetList null?: " + (_TweetList == null).ToString());
                _formError.AddInfoLine("_formOptions null? " + (_formOptions == null).ToString());
                _formError.AddInfoLine("_formNews null? " + (_formNews == null).ToString());
                _formError.AddInfoLine("_updateFinished = " + _updateFinished.ToString());

                _formError.AddInfoLine("_globalPackDir = " + _globalPackDir);
                _formError.AddInfoLine("_abortDownload = " + _abortDownload.ToString());
                _formError.AddInfoLine("_loadingSettings = " + _loadingSettings.ToString());
                _formError.AddInfoLine("_offlineMode = " + _offlineMode.ToString());

                _formError.AddInfoLine("}");

                bool hasInternetConnection = true;
                try
                {
                    hasInternetConnection = HasInternetConnection();
                }
                catch(Exception)
                {
                    hasInternetConnection = false;
                }

                if (!hasInternetConnection)
                {
                    _formError.AddInfoLine(Environment.NewLine + "Network Inferfaces" +  "{");
                    NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();
                    foreach (NetworkInterface adapter in interfaces)
                    {
                        _formError.AddInfoLine(string.Format("Name: {0}, Description: {1}, Type: {2}, State: {3}", adapter.Name, adapter.Description, adapter.NetworkInterfaceType.ToString(), adapter.OperationalStatus.ToString()));
                    }
                    _formError.AddInfoLine("}");
                }

                if (_formOptions != null)
                {
                    _formError.AddInfoLine(Environment.NewLine + "FormOptions information.  {");
                    List<string> information = _formOptions.formOptionsInformation();

                    foreach (string info in information)
                    {
                        _formError.AddInfoLine(info);
                    }
                    _formError.AddInfoLine("}");
                }

                _formError.CriticalError = criticalError;
                ShowErrorWindow(criticalError);
            }
            catch (Exception ex2)
            {
                MessageBox.Show("Woah hold on a sec. En error occurred in the error handling?. Damm this is bad. Please report this error as soon as possible" + Environment.NewLine + "Error: " + ex2.Message + Environment.NewLine + ex.StackTrace, "An Unlikely error occurred :(", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#5
0
        public void UpdateFreeMem()
        {
            ulong availablePhysicalMemory = new Microsoft.VisualBasic.Devices.ComputerInfo().AvailablePhysicalMemory;

            MainWindow.thisWindow.SetStatus(4, "Available Memory: " + availablePhysicalMemory.ToString("##,#"), 0);
        }
        public static string getRAM()
        {
            double RAM = new Microsoft.VisualBasic.Devices.ComputerInfo().TotalPhysicalMemory / 1048576;

            return(RAM.ToString() + " MB");
        }