private void loadLevelCSV(string strLevelCSV)
        {
            strLevelCSVFileName = strLevelCSV;
            Dispatcher.BeginInvoke(new Action(() =>
            {
                Title = "Zone File Editor => " + Variables.selectedMap_Name + ".csv";

                if (!Variables.checkFileExists(strLevelCSVFileName))
                {
                    string msgbox_msg = "Can't find " + this.strLevelCSVFileName + "\n" +
                                        "You may need to try building the fast file first so a zone source file will be created.";

                    MsgBoxWindow msgBoxWindow = new MsgBoxWindow(msgbox_msg, true)
                    {
                        Owner = this
                    };

                    msgBoxWindow.ShowDialog();
                    Close();
                }
                else
                {
                    // Using textbox because we need \n instead of \r\n
                    string zoneFile  = File.ReadAllText(strLevelCSVFileName);
                    txtLevelCSV.Text = zoneFile;
                }
            }));
        }
        private void readMissingAssets()
        {
            Dispatcher.BeginInvoke(new Action(() =>
            {
                string str = Variables.strTreePath + "main\\" + "missingasset.csv";

                if (!Variables.checkFileExists(str))
                {
                    string msgbox_msg = "Can't find " + str + "\n" +
                                        "Try building the level fast file again. \n" +
                                        "It's possible that the zone file is up to date.";

                    MsgBoxWindow msgBoxWindow = new MsgBoxWindow(msgbox_msg, true)
                    {
                        Owner = this
                    };

                    msgBoxWindow.ShowDialog();
                    Close();
                }
                else
                {
                    StreamReader streamReader = new StreamReader((Stream)File.OpenRead(str));

                    while (streamReader.Peek() != -1)
                    {
                        txtMissingAssets.AppendText(streamReader.ReadLine() + "\n\n");
                    }

                    streamReader.Close();
                }
            }));
        }
        /// <summary>
        /// Utility.cs \\ Check if Zone Files for map exist
        /// </summary>
        public bool CheckForZoneFiles(string strMapName)
        {
            bool fileExists;

            fileExists = checkFileExists(Variables.strZoneSourcePath + "\\" + strMapName + ".csv");

            if (!fileExists)
            {
                string msgbox_msg = "There are no zone files for " + strMapName + ".\n" +
                                    "Would you like to create them?";

                MsgBoxWindow msgBoxWindow = new MsgBoxWindow(msgbox_msg)
                {
                    Owner = this
                };

                msgBoxWindow.ShowDialog();

                if (msgBoxWindow.DialogResult.HasValue && msgBoxWindow.DialogResult.Value)
                {
                    if (createZoneFiles(strMapName))
                    {
                        fileExists = true;
                    }
                }
            }

            return(fileExists);
        }
        private void saveNewLevelCSV()
        {
            try
            {
                StreamWriter streamWriter = new StreamWriter((Stream) new FileStream(strLevelCSVFileName, FileMode.Create));

                streamWriter.Write(txtLevelCSV.Text); // Instead of WriteLine
                streamWriter.Close();

                Close();
            }
            catch (Exception ex)
            {
                ProjectData.SetProjectError(ex);

                string msgbox_msg = strLevelCSVFileName + " could not be successfully updated." + "\n" +
                                    "Make sure file wasn't removed and is not being used by something else.";

                MsgBoxWindow msgBoxWindow = new MsgBoxWindow(msgbox_msg, true)
                {
                    Owner = this
                };

                msgBoxWindow.ShowDialog();
                ProjectData.ClearProjectError();

                Close();
            }
        }
Exemple #5
0
        /// <summary>
        /// AppStartup.cs \\ Set language for path setup
        /// </summary>
        public void setLanguage()
        {
            string str1 = Variables.strTreePath + "localization.txt";

            if (StringType.StrCmp(Variables.strTreePath, "", false) == 0)
            {
                Variables.language = "english";
            }
            else
            {
                if (this.checkFileExists(str1))
                {
                    StreamReader streamReader = new StreamReader((Stream)File.OpenRead(str1));
                    string       str2         = streamReader.ReadLine();
                    streamReader.Close();

                    if (str2.Length > 0)
                    {
                        Variables.language = str2;
                    }
                }
                else
                {
                    Variables.language = "english";
                    string msgbox_msg = "Couldn't find \"" + str1 + "\" to see which language you are using. \n" + "Defaulting to English.";

                    MsgBoxWindow msgBoxWindow = new MsgBoxWindow(msgbox_msg, true);
                    msgBoxWindow.ShowDialog();
                }
            }
        }