How to exec .dat at boot

Hi,

Have almost finished this milestone release. Will do the registry when I get back this evening, but uploading what I have achieved this morning (a lot!)

Richard
 

Attachments

My Computer

System One

  • Manufacturer/Model
    Dell XPS 420
    CPU
    Intel Core 2 Quad Q9300 2.50GHz
    Motherboard
    Stock Dell 0TP406
    Memory
    4 gb (DDR2 800) 400MHz
    Graphics card(s)
    ATI Radeon HD 3870 (512 MBytes)
    Sound Card
    Onboard
    Monitor(s) Displays
    1 x Dell 2007FP and 1 x (old) Sonic flat screen
    Screen Resolution
    1600 x 1200 and 1280 x 1204
    Hard Drives
    1 x 640Gb (SATA 300) Western Digital: WDC WD6400AAKS-75A7B0 1 x 1Tb (SATA 600) Western Digital: Caviar Black, SATA 6GB/S, 64Mb cache, 8ms Western Digital: WDC WD1002FAEX-00Z3A0 ATA Device
    PSU
    Stock PSU - 375W
    Case
    Dell XPS 420
    Cooling
    Stock Fan
    Mouse
    Advent Optical ADE-WG01 (colour change light up)
    Keyboard
    Dell Bluetooth
    Internet Speed
    120 kb/s
    Other Info
    ASUS USB 3.0 5Gbps/SATA 6Gbps - PCI-Express Combo Controller Card (U3S6)
Hi Richard,

I upload sound_20100408.zip to this posting which consists of following 2 sound files
Code:
Thanks_to_God.mp3
Thanks_to_God.wav
Some old PCs can't play .mp3 file without installing mp3 player. Most PC can basically play .wav files. Please try them. Thanks

B.R.
satimis
 

My Computer

Hi Richard,

What about add background on the verse window. I can made each "Bible Verse of The Day" displayed on its own background. It will be very attractive. But in doing so the size of the file will be increased dramatically.

I attach 2 star background for your consideration. One is static and another animated. White/Yellow characters


B.R.
satimis
 

Attachments

  • star_animated.gif
    star_animated.gif
    7 KB · Views: 21
  • starbg.jpg
    starbg.jpg
    2.4 KB · Views: 38

My Computer

Hello,

Have finished this milestone release (sorry, haven't done the background yet, will do that now) I have also used something called a Resource file. This means that the .dat files and background tracks are stored in the one .exe, rather than separately. If you want this undone, it is very easy for me to undo. They are however very easy to edit if you ever want any changes made.

Richard
 

My Computer

System One

  • Manufacturer/Model
    Dell XPS 420
    CPU
    Intel Core 2 Quad Q9300 2.50GHz
    Motherboard
    Stock Dell 0TP406
    Memory
    4 gb (DDR2 800) 400MHz
    Graphics card(s)
    ATI Radeon HD 3870 (512 MBytes)
    Sound Card
    Onboard
    Monitor(s) Displays
    1 x Dell 2007FP and 1 x (old) Sonic flat screen
    Screen Resolution
    1600 x 1200 and 1280 x 1204
    Hard Drives
    1 x 640Gb (SATA 300) Western Digital: WDC WD6400AAKS-75A7B0 1 x 1Tb (SATA 600) Western Digital: Caviar Black, SATA 6GB/S, 64Mb cache, 8ms Western Digital: WDC WD1002FAEX-00Z3A0 ATA Device
    PSU
    Stock PSU - 375W
    Case
    Dell XPS 420
    Cooling
    Stock Fan
    Mouse
    Advent Optical ADE-WG01 (colour change light up)
    Keyboard
    Dell Bluetooth
    Internet Speed
    120 kb/s
    Other Info
    ASUS USB 3.0 5Gbps/SATA 6Gbps - PCI-Express Combo Controller Card (U3S6)
Hello,

Have finished this milestone release (sorry, haven't done the background yet, will do that now) I have also used something called a Resource file. This means that the .dat files and background tracks are stored in the one .exe, rather than separately. If you want this undone, it is very easy for me to undo. They are however very easy to edit if you ever want any changes made.

Hi Richard ,

Some problem occurs here. The program doesn't start.

Steps:-

Download Verse_of_the_Day_Beta2.zip on desktop

Extract it on the desktop, only the .exe file found. Double clicking it starts the program with following warning displayed finally.

Code:
Microsoft Windows
Verse_of_the_Day has stopped working
A problem caused the program to stop working correctly.  Windows will close the program and notify your if as solution is available

Unblock it on properties without improvement.

satimis

P.S. I used the old .dat file
 

My Computer

Hello,

Thanks for the info. This is very strange, and I am not experiencing this issue. Can you please run the Program as an Administrator (on the right click context menu) and see if that fixes the issue (this is not a permanent solution)

Also, I have included a special debugging build to help aid me, so can you please run that and list all the errors until it crashes or works. Thanks!

Richard
 

My Computer

System One

  • Manufacturer/Model
    Dell XPS 420
    CPU
    Intel Core 2 Quad Q9300 2.50GHz
    Motherboard
    Stock Dell 0TP406
    Memory
    4 gb (DDR2 800) 400MHz
    Graphics card(s)
    ATI Radeon HD 3870 (512 MBytes)
    Sound Card
    Onboard
    Monitor(s) Displays
    1 x Dell 2007FP and 1 x (old) Sonic flat screen
    Screen Resolution
    1600 x 1200 and 1280 x 1204
    Hard Drives
    1 x 640Gb (SATA 300) Western Digital: WDC WD6400AAKS-75A7B0 1 x 1Tb (SATA 600) Western Digital: Caviar Black, SATA 6GB/S, 64Mb cache, 8ms Western Digital: WDC WD1002FAEX-00Z3A0 ATA Device
    PSU
    Stock PSU - 375W
    Case
    Dell XPS 420
    Cooling
    Stock Fan
    Mouse
    Advent Optical ADE-WG01 (colour change light up)
    Keyboard
    Dell Bluetooth
    Internet Speed
    120 kb/s
    Other Info
    ASUS USB 3.0 5Gbps/SATA 6Gbps - PCI-Express Combo Controller Card (U3S6)
Hello,

  • Crash the old application (not the new debug one)

  • Press the Windows key + R to open the Run dialogue.

  • Type: %USERPROFILE%\AppData\Local\Microsoft\Windows\WER\ReportArchive and press enter.

  • Sort by date, and open the most recent folder starting with Report.

  • Upload the Report.wer in that folder in zip format.
Thanks very much, and sorry for this issue.

Richard
 

My Computer

System One

  • Manufacturer/Model
    Dell XPS 420
    CPU
    Intel Core 2 Quad Q9300 2.50GHz
    Motherboard
    Stock Dell 0TP406
    Memory
    4 gb (DDR2 800) 400MHz
    Graphics card(s)
    ATI Radeon HD 3870 (512 MBytes)
    Sound Card
    Onboard
    Monitor(s) Displays
    1 x Dell 2007FP and 1 x (old) Sonic flat screen
    Screen Resolution
    1600 x 1200 and 1280 x 1204
    Hard Drives
    1 x 640Gb (SATA 300) Western Digital: WDC WD6400AAKS-75A7B0 1 x 1Tb (SATA 600) Western Digital: Caviar Black, SATA 6GB/S, 64Mb cache, 8ms Western Digital: WDC WD1002FAEX-00Z3A0 ATA Device
    PSU
    Stock PSU - 375W
    Case
    Dell XPS 420
    Cooling
    Stock Fan
    Mouse
    Advent Optical ADE-WG01 (colour change light up)
    Keyboard
    Dell Bluetooth
    Internet Speed
    120 kb/s
    Other Info
    ASUS USB 3.0 5Gbps/SATA 6Gbps - PCI-Express Combo Controller Card (U3S6)
Hello,

  • Crash the old application (not the new debug one)
  • Press the Windows key + R to open the Run dialogue.
  • Type: %USERPROFILE%\AppData\Local\Microsoft\Windows\WER\ReportArchive and press enter.
  • Sort by date, and open the most recent folder starting with Report.
  • Upload the Report.wer in that folder in zip format.
Thanks very much, and sorry for this issue.

Hi Richard


The previous Verse_of_the_Day (post #44) can be started as Admin. But only the old window popup. It can't be deleted as user. I must login as Admin to delete it.

The Verse_of_the_Day_debug attached to post #46 can be started as user with following warning popup;
Code:
REGISTRY: ERROR 1 [ok]
REGISTRY: ERROR 1 [ok]
REGISTRY: ERROR 1 [ok]
REGISTRY: ERROR 1 [ok]
REGISTRY: ERROR 1 [ok]
warning closed. No further response.


The said Verse_of_the_Day_debug can be started as Admin correctly. "Bible Verse of the Day" displayed and music played. Wonderful!!!

Suggustion;

1)
bold on;
Bible Verse of the Day (heading)
Thanks be to God
Amend
Language

2)
Move the drop window to the left leaving more room between it and the frame border

3)
Move the source "Philippians 4:8" to left making "8"(end) aligned vertically with each line of the verse (forget last line), if possible

Thanks for your hard work

The debug reports are attached to this posting;
Report.wer-20100409-0737pm
Report.wer-20100409-0730pm
(folder Report-bug.zip)

I can't read them. Which program is used for reading them?

B.R.
satimis


Remark:

It is quite funny that I tried running following command on "Command Prompt" to compress the reports as .zip file without success
Code:
zip Report-bug.zip file1 file2
pkzip Report-bug.zip file1 file2
winzip Report-bug.zip file1 file2

None of them can work. Finally I have to do it with mouse point
- Create a folder
- Move the files to the folder
- Right click the folder -> Send To -> Compressed (zipped) Folder
- Rename the new folder


I prefer running command line instead of clicking around with mouse pointer. Any advice? Thanks
 

Attachments

My Computer

Hi,

Have fixed the bug (I think!) so that the program can now be run as a standard user, rather than having to be run as a Admin (without crashing!). Will follow up your other suggestions now.

Richard
 

My Computer

System One

  • Manufacturer/Model
    Dell XPS 420
    CPU
    Intel Core 2 Quad Q9300 2.50GHz
    Motherboard
    Stock Dell 0TP406
    Memory
    4 gb (DDR2 800) 400MHz
    Graphics card(s)
    ATI Radeon HD 3870 (512 MBytes)
    Sound Card
    Onboard
    Monitor(s) Displays
    1 x Dell 2007FP and 1 x (old) Sonic flat screen
    Screen Resolution
    1600 x 1200 and 1280 x 1204
    Hard Drives
    1 x 640Gb (SATA 300) Western Digital: WDC WD6400AAKS-75A7B0 1 x 1Tb (SATA 600) Western Digital: Caviar Black, SATA 6GB/S, 64Mb cache, 8ms Western Digital: WDC WD1002FAEX-00Z3A0 ATA Device
    PSU
    Stock PSU - 375W
    Case
    Dell XPS 420
    Cooling
    Stock Fan
    Mouse
    Advent Optical ADE-WG01 (colour change light up)
    Keyboard
    Dell Bluetooth
    Internet Speed
    120 kb/s
    Other Info
    ASUS USB 3.0 5Gbps/SATA 6Gbps - PCI-Express Combo Controller Card (U3S6)
Hi,

Have fixed the bug (I think!) so that the program can now be run as a standard user, rather than having to be run as a Admin (without crashing!). Will follow up your other suggestions now.

Richard

Hi,


This verse works. Thanks

Is it possible adjusting the location of the window to be displayed. It is now at the left top corner. Centre of screen is the best location. IIRC the orginal software displays the verse window in the centre of screen


Edit:

The [X] (red) but at the top, right, can be removed. Clickinng [Amend] will close the window.


satimis
 

My Computer

My Computer

System One

  • Manufacturer/Model
    Dell XPS 420
    CPU
    Intel Core 2 Quad Q9300 2.50GHz
    Motherboard
    Stock Dell 0TP406
    Memory
    4 gb (DDR2 800) 400MHz
    Graphics card(s)
    ATI Radeon HD 3870 (512 MBytes)
    Sound Card
    Onboard
    Monitor(s) Displays
    1 x Dell 2007FP and 1 x (old) Sonic flat screen
    Screen Resolution
    1600 x 1200 and 1280 x 1204
    Hard Drives
    1 x 640Gb (SATA 300) Western Digital: WDC WD6400AAKS-75A7B0 1 x 1Tb (SATA 600) Western Digital: Caviar Black, SATA 6GB/S, 64Mb cache, 8ms Western Digital: WDC WD1002FAEX-00Z3A0 ATA Device
    PSU
    Stock PSU - 375W
    Case
    Dell XPS 420
    Cooling
    Stock Fan
    Mouse
    Advent Optical ADE-WG01 (colour change light up)
    Keyboard
    Dell Bluetooth
    Internet Speed
    120 kb/s
    Other Info
    ASUS USB 3.0 5Gbps/SATA 6Gbps - PCI-Express Combo Controller Card (U3S6)
Hello,

There is no really easy way to zip up files from the Command Line. The easiest way is to download 7-Zip:

GUI: Download 7-Zip from SourceForge.net

Command Line: Download 7-Zip from SourceForge.net

To zip up files from the Command Line with difficulty without any extra tools, see this thread: Can you zip a file from command prompt? - Super User

Not very neat!

Richard

Or you can just shift+right click on what you want to zip up and click send to > Zipped (compressed) Folder

Oli
 

My Computer

System One

  • Manufacturer/Model
    Apple MacBook, 5,1
    CPU
    Intel Core 2 Duo 2.4Ghz
    Memory
    4GB DDR3
    Graphics card(s)
    Nvidia 9400m
    Monitor(s) Displays
    13.3" Apple MacBook LCD Screen + 22" HannsG DVI LCD + 21.5" Samsung USB Lapfit Monitor LD220
    Screen Resolution
    1280x800 + 1920x1080 + 1920x1080
    Hard Drives
    SATA Internal 2.5" 500GB (305GB HFS+, 195GB NTFS) External USB 3.5" 1TB (HFS+)
    Case
    Aluminium Unibody
    Mouse
    Apple Magic Mouse
    Keyboard
    Apple Late 2009 Wireless Keyboard (US)
    Internet Speed
    6.33Mb/s up. 0.36Mb/s down.
    Other Info
    Harman Kardon Soundsticks II Speakers
Hello,

There is no really easy way to zip up files from the Command Line. The easiest way is to download 7-Zip:

GUI: Download 7-Zip from SourceForge.net

Command Line: Download 7-Zip from SourceForge.net

To zip up files from the Command Line with difficulty without any extra tools, see this thread: Can you zip a file from command prompt? - Super User

Not very neat!

Richard

Or you can just shift+right click on what you want to zip up and click send to > Zipped (compressed) Folder

Hi Oli,

Advice noted. Thanks

satimis
 

My Computer

Hello Satimis,

It now opens centred. The title is now properly aligned. The three controls in the top right hand corner no longer show up. Do you want the static or animated background, I can do either? One thing I am a bit confused about is the position of Amen, Thanks be to God, and the Language selection. Thanks!

Richard

P.S. Do you know the framerate of that .gif, or should I just set it to 30 and see what happens?
 
Last edited:

My Computer

System One

  • Manufacturer/Model
    Dell XPS 420
    CPU
    Intel Core 2 Quad Q9300 2.50GHz
    Motherboard
    Stock Dell 0TP406
    Memory
    4 gb (DDR2 800) 400MHz
    Graphics card(s)
    ATI Radeon HD 3870 (512 MBytes)
    Sound Card
    Onboard
    Monitor(s) Displays
    1 x Dell 2007FP and 1 x (old) Sonic flat screen
    Screen Resolution
    1600 x 1200 and 1280 x 1204
    Hard Drives
    1 x 640Gb (SATA 300) Western Digital: WDC WD6400AAKS-75A7B0 1 x 1Tb (SATA 600) Western Digital: Caviar Black, SATA 6GB/S, 64Mb cache, 8ms Western Digital: WDC WD1002FAEX-00Z3A0 ATA Device
    PSU
    Stock PSU - 375W
    Case
    Dell XPS 420
    Cooling
    Stock Fan
    Mouse
    Advent Optical ADE-WG01 (colour change light up)
    Keyboard
    Dell Bluetooth
    Internet Speed
    120 kb/s
    Other Info
    ASUS USB 3.0 5Gbps/SATA 6Gbps - PCI-Express Combo Controller Card (U3S6)
Hello,

Forgot to mention, you can open the reports using Notepad ;)

Richard
 

My Computer

System One

  • Manufacturer/Model
    Dell XPS 420
    CPU
    Intel Core 2 Quad Q9300 2.50GHz
    Motherboard
    Stock Dell 0TP406
    Memory
    4 gb (DDR2 800) 400MHz
    Graphics card(s)
    ATI Radeon HD 3870 (512 MBytes)
    Sound Card
    Onboard
    Monitor(s) Displays
    1 x Dell 2007FP and 1 x (old) Sonic flat screen
    Screen Resolution
    1600 x 1200 and 1280 x 1204
    Hard Drives
    1 x 640Gb (SATA 300) Western Digital: WDC WD6400AAKS-75A7B0 1 x 1Tb (SATA 600) Western Digital: Caviar Black, SATA 6GB/S, 64Mb cache, 8ms Western Digital: WDC WD1002FAEX-00Z3A0 ATA Device
    PSU
    Stock PSU - 375W
    Case
    Dell XPS 420
    Cooling
    Stock Fan
    Mouse
    Advent Optical ADE-WG01 (colour change light up)
    Keyboard
    Dell Bluetooth
    Internet Speed
    120 kb/s
    Other Info
    ASUS USB 3.0 5Gbps/SATA 6Gbps - PCI-Express Combo Controller Card (U3S6)
It now opens centred. The title is now properly aligned. The three controls in the top right hand corner no longer show up.

Hi Richard,

Thanks. Good decision.

I don't think users need those 3 controls. They can close the window by clicking "Amen". Regarding the "shrink" control, it is only for those users who need to enjoy the melody of "Thanks be to God'. Then they can shrink the control to bottom bar allowing the melody continue to play if the "shrink" control is there. However I don't think this is necessary.


Do you want the static or animated background, I can do either?

Animated background please. If we found problem later then we can change it to static background. Thanks


One thing I am a bit confused about is the position of Amen, Thanks be to God, and the Language selection. Thanks!
Their positions are OK. Just adjust their distance corresponding to the frame on both sides.


B.R.
satimis


P.S. Do you know the framerate of that .gif, or should I just set it to 30 and see what happens?
Good idea. I don't know it as well. Thanks
 

My Computer

I don't think users need those 3 controls. They can close the window by clicking "Amen". Regarding the "shrink" control, it is only for those users who need to enjoy the melody of "Thanks be to God'. Then they can shrink the control to bottom bar allowing the melody continue to play if the "shrink" control is there. However I don't think this is necessary.

I only did this because you can remove none of them, remove all three, or just disable the operation of the Red X. I thought that this was the best configuration that was possible.

Richard
 

My Computer

System One

  • Manufacturer/Model
    Dell XPS 420
    CPU
    Intel Core 2 Quad Q9300 2.50GHz
    Motherboard
    Stock Dell 0TP406
    Memory
    4 gb (DDR2 800) 400MHz
    Graphics card(s)
    ATI Radeon HD 3870 (512 MBytes)
    Sound Card
    Onboard
    Monitor(s) Displays
    1 x Dell 2007FP and 1 x (old) Sonic flat screen
    Screen Resolution
    1600 x 1200 and 1280 x 1204
    Hard Drives
    1 x 640Gb (SATA 300) Western Digital: WDC WD6400AAKS-75A7B0 1 x 1Tb (SATA 600) Western Digital: Caviar Black, SATA 6GB/S, 64Mb cache, 8ms Western Digital: WDC WD1002FAEX-00Z3A0 ATA Device
    PSU
    Stock PSU - 375W
    Case
    Dell XPS 420
    Cooling
    Stock Fan
    Mouse
    Advent Optical ADE-WG01 (colour change light up)
    Keyboard
    Dell Bluetooth
    Internet Speed
    120 kb/s
    Other Info
    ASUS USB 3.0 5Gbps/SATA 6Gbps - PCI-Express Combo Controller Card (U3S6)
Hello,

Here is the new release that contains lots of changes from the previous version and I have included all the complex and time consuming code in this version, which is why it took so long. I will now write the second thread for the .gif background (which isn't natively supported, but is very easy to integrate ( < 10 lines of code)) Also, because I have lots of time today, I will include the latest code. This code is not in a project, and uses the Resource file, so is not compilable, just for you to look at. In particular, MainForm.cs will interest you, because it contains some very simple and more complex code.

One question, by how much do your want Language and Amen to be moved, and are the font sizes OK? This and the background will be in the next release.

MainForm.cs:
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Media;
using System.Text;
using System.Windows.Forms;
using System.Windows.Input;
using System.Reflection;
using System.Resources;
using System.Diagnostics;
using System.IO;
using Microsoft.Win32;

namespace Verse_of_the_Day
{
    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();

            richTextBox1.Text = "\"" + Variables.verselist[Variables.publicI] + "\"";

            int x = (int)richTextBox1.GetCharIndexFromPosition(new Point(416,208));

            if (richTextBox1.GetLineFromCharIndex(x) + 1 == 1)
            {
                label1.Top = 120;
            }
            else if (richTextBox1.GetLineFromCharIndex(x) + 1 == 2)
            {
                label1.Top = 136;
            }
            else if (richTextBox1.GetLineFromCharIndex(x) + 1 == 3)
            {
                label1.Top = 152;
            }
            else if (richTextBox1.GetLineFromCharIndex(x) + 1 == 4)
            {
                label1.Top = 168;
            }
            else if (richTextBox1.GetLineFromCharIndex(x) + 1 == 5)
            {
                label1.Top = 192;
            }
            else if (richTextBox1.GetLineFromCharIndex(x) + 1 == 6)
            {
                label1.Top = 208;
            }


            try
            {
                Assembly assembly = Assembly.GetExecutingAssembly();
                SoundPlayer background = new SoundPlayer(assembly.GetManifestResourceStream("Verse_of_the_Day.Thanks_to_God.wav"));
                background.PlayLooping(); 
            }
            catch
            {
                MessageBox.Show("SOUND: ERROR 1");
            }

            try
            {
            comboBox1.SelectedItem = Variables.language;

            comboBox1.TabStop = false;

            label1.Text = Variables.titlelist[Variables.publicI];
            label1.AutoEllipsis = false;
            label1.AutoSize = false;
            label1.RightToLeft = System.Windows.Forms.RightToLeft.No;
            label1.TextAlign = ContentAlignment.MiddleRight;
            }
            catch
            {
                MessageBox.Show("FORM: ERROR 1");
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Environment.Exit(0);
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if ((string)comboBox1.SelectedItem == "English")
            {
                try
                {
                RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Bible Verse of the Day", true);
                key.SetValue("language", "English", RegistryValueKind.String);
                key.Close();
                }
                catch
                {
                    MessageBox.Show("REGISTRY: ERROR 6");
                }
            }
        }

        protected override void OnLoad(EventArgs e)
        {
            Screen scr = Screen.FromPoint(new Point(this.Left, this.Top));
            this.Left = scr.Bounds.Left + (scr.Bounds.Width - this.Width) / 2;
            this.Top = scr.Bounds.Top + (scr.Bounds.Height - this.Height) / 2;
        }
    }
}
\Lang\English.cs:
Code:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Windows.Forms;

namespace Verse_of_the_Day
{
    class English
    {
        public static void ReadWrite()
        {
            try
            {
                Assembly assembly = Assembly.GetExecutingAssembly();

                // Create an instance of StreamReader to read from a file.
                // The using statement also closes the StreamReader.
                //using (StreamReader sr = new StreamReader("linbread.dat", System.Text.Encoding.Default))
                using (StreamReader sr = new StreamReader(assembly.GetManifestResourceStream("Verse_of_the_Day.linbread.dat"), System.Text.Encoding.Default))
                {
                    // Read ALL of the .dat file into one (big) string
                    Variables.file = sr.ReadToEnd();
                }
            }
            catch (Exception e)
            {
                // Let the user know what went wrong.
                MessageBox.Show("The file could not be read:" + e);
            }

            // Split the one big string into many smaller strings
            string[] split = Variables.file.Split('"');

            for (int i = 0; i < split.Length; i++)
            {
                // This section cuts up the string sections and stores them
                if (i % 2 == 0 && i != 0 && i != split.Length - 1) // << For every other string (all the even ones except for string 0) NOTE: List indexes start at 0 not 1 so index 0 is the first string in list
                {
                    // Cut into date and title and remove any unwanted characters, store date and title
                    string result = split[i].Remove(0, 1);
                    result = result.Remove(result.Length - 1, 1);

                    Variables.date = result.Substring(result.Length - 5);
                    Variables.title = result.Remove(result.Length - 5);

                    Variables.date = Variables.date.Replace(Environment.NewLine, "");

                    Variables.datelist.Add(Variables.date);
                    Variables.titlelist.Add(Variables.title);

                }
                else if (i == 0) // << If string index is 0
                {
                    // Remove unwanted character and store date
                    Variables.date = split[i].Remove(4);
                    Variables.date = Variables.date.Replace(Environment.NewLine, "");
                    Variables.datelist.Add(Variables.date);
                }
                else if (i % 2 != 0 && 1 != split.Length - 1) // << For every other string (all the odd ones)
                {
                    // No unwanted characters so just store
                    Variables.verse = split[i];
                    Variables.verselist.Add(Variables.verse);
                }
                else if (i == split.Length - 1)
                {
                    string result = split[i].Remove(0, 1);
                    result = result.Replace("\n", "");
                    Variables.titlelist.Add(result);
                }
            }

            try
            {
                if (Variables.today == "0101")
                {
                    // Exception to rule at 1st January
                    Variables.publicI = Variables.datelist.IndexOf(Variables.today);
                }
                else
                {
                    // Every other date, find index of that date (dates in order)
                    Variables.publicI = Variables.datelist.IndexOf("\n" + Variables.today);
                }
            }
            catch (Exception e)
            {
                // Tell user what went wrong
                MessageBox.Show("Fatal Error:" + e);
            }

            try
            {
                // Using index from previous section, get matching verse and title
                // MessageBox.Show("\"" + Variables.verselist[Variables.publicI] + "\"" + "\n\n" + Variables.titlelist[Variables.publicI]);

                Application.Run(new MainForm());
                
            }
            catch (Exception e)
            {
                // Tell user what went wrong
                MessageBox.Show("Fatal Error:" + e);
            }
        }
    }
}
Program.cs:
Code:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using Microsoft.Win32;

namespace Verse_of_the_Day
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>

        [STAThread]
        static void Main()
        {      
            // Get today's date in format used in .dat file
            GetDate();

            try
            {
                Variables.key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Bible Verse of the Day", true);
            }
            catch
            {
                MessageBox.Show("REGISTRY: ERROR 1");
            }

            try
            {
                if (Variables.key == null)
                    {
                    Variables.key = Registry.CurrentUser.CreateSubKey("SOFTWARE\\Bible Verse of the Day");
                    }
            }
            catch  
            {
                MessageBox.Show("REGISTRY: ERROR 2");
            }

            try
            {
                Variables.language = (string)Variables.key.GetValue("language");
            }
            catch
            {
                MessageBox.Show("REGISTRY: ERROR 3");
            }

            try
            {
                if (Variables.key.GetValue("language") == null)
                {
                    Variables.key.SetValue("language", "English", RegistryValueKind.String);
                }
            }
            catch
            {
                MessageBox.Show("REGISTRY: ERROR 4");
            }

            try
            {
                Variables.key.Close();
            }
            catch
            {
                MessageBox.Show("REGISTRY: ERROR 5");
            }

            // For English language
            try
            {
            if (Variables.language == "English")
            {
                English.ReadWrite();
            }
            }
            catch
            {
                MessageBox.Show("ENGLISH: ERROR 1");
            }
        }

        

        public static void GetDate()
        {
            // Get today's date in format used in .dat file
            Variables.today = DateTime.Now.ToString("MMdd");
        }

    }
}
Variables.cs:
Code:
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;

namespace Verse_of_the_Day
{
    class Variables
    {
        public static string today;
        public static string date;
        public static string title;
        public static string verse;
        public static string file;
        public static string language;
        public static int publicI;
        public static List<string> datelist = new List<string>();
        public static List<string> verselist = new List<string>();
        public static List<string> titlelist = new List<string>();
        public static List<string> stringlist = new List<string>();
        public static RegistryKey key;


    }
}
Have fun reading all that!

Richard
 

My Computer

System One

  • Manufacturer/Model
    Dell XPS 420
    CPU
    Intel Core 2 Quad Q9300 2.50GHz
    Motherboard
    Stock Dell 0TP406
    Memory
    4 gb (DDR2 800) 400MHz
    Graphics card(s)
    ATI Radeon HD 3870 (512 MBytes)
    Sound Card
    Onboard
    Monitor(s) Displays
    1 x Dell 2007FP and 1 x (old) Sonic flat screen
    Screen Resolution
    1600 x 1200 and 1280 x 1204
    Hard Drives
    1 x 640Gb (SATA 300) Western Digital: WDC WD6400AAKS-75A7B0 1 x 1Tb (SATA 600) Western Digital: Caviar Black, SATA 6GB/S, 64Mb cache, 8ms Western Digital: WDC WD1002FAEX-00Z3A0 ATA Device
    PSU
    Stock PSU - 375W
    Case
    Dell XPS 420
    Cooling
    Stock Fan
    Mouse
    Advent Optical ADE-WG01 (colour change light up)
    Keyboard
    Dell Bluetooth
    Internet Speed
    120 kb/s
    Other Info
    ASUS USB 3.0 5Gbps/SATA 6Gbps - PCI-Express Combo Controller Card (U3S6)
Back
Top