コード例 #1
0
        public void loadXML(string fileName, bool bOnlyGlobalSettings)
        {
            try
            {
                //textBox1.Text = fileName;

                List <LightXML> saveThelocalLights = mLightSet.mLights;

                //XmlSerializer s = new XmlSerializer(typeof(lightSetXML), new Type[] { });
                //Stream st = File.OpenRead(fileName);
                //mLightSet = (lightSetXML)s.Deserialize(st);
                //st.Close();
                mLightSet = SimGlobals.getSimMain().LoadScenarioLights(fileName, !bOnlyGlobalSettings);

                if (bOnlyGlobalSettings == true)
                {
                    mLightSet.mLights = saveThelocalLights;
                }



                this.betterPropertyGrid1.SelectedObject = mLightSet;
            }
            catch (System.Exception ex)
            {
                CoreGlobals.getErrorManager().OnException(ex);
            }
        }
コード例 #2
0
        public unsafe bool writeToFile(string filename)
        {
            try
            {
                if (File.Exists(CoreGlobals.getWorkPaths().mTAGToolPath) == false)
                {
                    MessageBox.Show("Can't find: " + CoreGlobals.getWorkPaths().mXMBToolPath, "Error generating " + filename);
                    return(false);
                }

                string arguments = "";
                arguments = arguments + " -create";
                arguments = arguments + " -outFile \"" + filename + "\"";
                foreach (string output in mFilesToBeTagged)
                {
                    arguments = arguments + " -file \"" + output + "\"";
                }

                System.Diagnostics.Process process;
                process = new System.Diagnostics.Process();
                process = System.Diagnostics.Process.Start(CoreGlobals.getWorkPaths().mTAGToolPath, arguments);
                process.WaitForExit();
                process.Close();
            }
            catch (System.Exception ex)
            {
                CoreGlobals.getErrorManager().OnException(ex);
                return(false);
            }
            return(true);
        }
コード例 #3
0
        protected void SaveAs()
        {
            try
            {
                SaveFileDialog d = new SaveFileDialog();
                d.Filter           = GetFilter();
                d.InitialDirectory = GetInitialDirectory();
                if (d.ShowDialog() == DialogResult.OK)
                {
                    XmlSerializer s  = new XmlSerializer(typeof(TriggerRoot), new Type[] { });
                    Stream        st = File.Open(d.FileName, FileMode.Create);
                    mSavedFileName = d.FileName;

                    TriggerRoot root = TriggerData;
                    root.Name = Path.GetFileName(mSavedFileName);
                    root.Type = mType;
                    s.Serialize(st, root);

                    //s.Serialize(st, TriggerData);
                    st.Close();
                    this.Parent.Text = Path.GetFileName(d.FileName);

                    triggerHostArea1.Scan(true);


                    XMBProcessor.CreateXMB(mSavedFileName, false);
                }
            }
            catch (System.Exception ex)
            {
                CoreGlobals.getErrorManager().OnException(ex);
            }
        }
コード例 #4
0
        //-------------------------------------------
        //public void exportPTH(string filename, ref Export360.ExportResults results)
        //{
        //   DateTime n = DateTime.Now;
        //      filename = Path.ChangeExtension(filename, ".PTH");
        //      XSD_NavMesh nm = new XSD_NavMesh();
        //      nm.generateNavMesh(TerrainGlobals.getEditor().getSimRep().getNavMeshQuantizationDist(),512);
        //      nm.exportNavMeshToPTH(filename);
        //      nm = null;
        //      TimeSpan ts = DateTime.Now - n;
        //      results.terrainPTHTime = ts.TotalMinutes;

        //}
        //---------------------------------
        public bool CreateLRP(string filename)
        {
            try
            {
                //genPTH -terrainFile <*.XSD> -lrpTreeFile <*.LRP>
                if (File.Exists(CoreGlobals.getWorkPaths().mLRPToolPath) == false)
                {
                    MessageBox.Show("Can't find: " + CoreGlobals.getWorkPaths().mLRPToolPath, "Error exporting " + filename);
                    return(false);
                }

                string xsdFile = filename.Substring(0, filename.LastIndexOf('.'));// Path.ChangeExtension(filename, "");
                string lrpFile = Path.ChangeExtension(filename, "LRP");

                if (File.Exists(lrpFile))
                {
                    File.Delete(lrpFile);
                }

                string arguments = "";
                arguments = arguments + " -terrainFile \"" + xsdFile + "\"";
                arguments = arguments + " -lrpTreeFile \"" + lrpFile + "\"";

                System.Diagnostics.Process pthUtility;
                pthUtility = new System.Diagnostics.Process();
                pthUtility = System.Diagnostics.Process.Start(CoreGlobals.getWorkPaths().mLRPToolPath, arguments);
                pthUtility.WaitForExit();
                pthUtility.Close();
            }
            catch (System.Exception ex)
            {
                CoreGlobals.getErrorManager().OnException(ex);
            }
            return(true);
        }
コード例 #5
0
        public void Start()
        {
            try
            {
                mRTStylus = new RealTimeStylus(mParent);
                mPlugin   = new SimpleStylusPlugin(this);
                mRTStylus.SyncPluginCollection.Add(mPlugin);
                Guid[] g = new Guid[] { PacketProperty.X, PacketProperty.Y, PacketProperty.NormalPressure, PacketProperty.XTiltOrientation, PacketProperty.YTiltOrientation };
                mRTStylus.SetDesiredPacketDescription(g);


                Tablets theTablets = new Tablets();
                string  theReport  = Environment.NewLine;
                foreach (Tablet theTablet in theTablets)
                {
                    if (theTablet.IsPacketPropertySupported(PacketProperty.NormalPressure))
                    {
                        TabletPropertyMetrics theMetrics = theTablet.GetPropertyMetrics(PacketProperty.NormalPressure);
                        mMaxPressure = theMetrics.Maximum;
                    }
                }



                mRTStylus.Enabled = true;
            }
            catch (System.Exception ex)
            {
                CoreGlobals.getErrorManager().OnSimpleWarning(ex.ToString());
            }
        }
コード例 #6
0
        private void AutoAddButton_Click(object sender, EventArgs e)
        {
            try
            {
                string[] subDirs = Directory.GetDirectories(CoreGlobals.getWorkPaths().mGameScenarioDirectory);

                foreach (string dir in subDirs)
                {
                    string[] files = Directory.GetFiles(dir, "*.scn");
                    foreach (string scenfile in files)
                    {
                        if (SearchForFile(scenfile) == false)
                        {
                            ScenarioInfoXml scenInfo = new ScenarioInfoXml();
                            scenInfo.File = scenfile.Replace(CoreGlobals.getWorkPaths().mGameScenarioDirectory + "\\", "");
                            //scenInfo.Name = Path.GetFileNameWithoutExtension(scenfile);
                            mScenarioDescriptions.ScenarioInfoList.Add(scenInfo);
                        }
                    }
                }

                //basicTypedSuperList1.BatchSuspend();

                //this.basicTypedSuperList1.ObjectList = mScenarioDescriptions.ScenarioInfoList;
                basicTypedSuperList1.UpdateData();
                //basicTypedSuperList1.BatchResume();
            }
            catch (System.Exception ex)
            {
                CoreGlobals.getErrorManager().OnException(ex);
            }
        }
コード例 #7
0
        private void ImportButton_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("This will erase the existing triggers.", "Warning!", MessageBoxButtons.OKCancel) != DialogResult.OK)
            {
                return;
            }

            try
            {
                OpenFileDialog d = new OpenFileDialog();
                d.Filter           = "Script (*" + CoreGlobals.getWorkPaths().mScriptExtention + ")|*" + CoreGlobals.getWorkPaths().mScriptExtention;
                d.InitialDirectory = CoreGlobals.getWorkPaths().mScriptTriggerDirectory;
                if (d.ShowDialog() == DialogResult.OK)
                {
                    XmlSerializer s  = new XmlSerializer(typeof(TriggerRoot), new Type[] { });
                    Stream        st = File.OpenRead(d.FileName);
                    TriggerData = (TriggerRoot)s.Deserialize(st);
                    st.Close();
                }
            }
            catch (System.Exception ex)
            {
                CoreGlobals.getErrorManager().OnException(ex);
            }
        }
コード例 #8
0
        private void SaveAsTemplate()
        {
            try
            {
                SaveFileDialog d = new SaveFileDialog();
                d.Filter           = "Templates (*.xml)|*.xml";
                d.InitialDirectory = CoreGlobals.getWorkPaths().mTemplateRoot;
                if (d.ShowDialog() == DialogResult.OK)
                {
                    XmlSerializer s  = new XmlSerializer(typeof(TriggerTemplateDefinition), new Type[] { });
                    Stream        st = File.Open(d.FileName, FileMode.Create);

                    s.Serialize(st, TemplateDefinition);
                    st.Close();
                    this.Parent.Text = Path.GetFileName(d.FileName);

                    saveAsName = d.FileName;

                    triggerHostArea1.Scan(true);

                    //Not used by game, no xmb needed
                }
            }
            catch (System.Exception ex)
            {
                CoreGlobals.getErrorManager().OnException(ex);
            }
        }
コード例 #9
0
        //Remove the binding target
        void output_ControlPointRemoved(BasicControlPoint cp, IControlPoint other)
        {
            if (other.Virtual == true)
            {
                return;
            }
            TriggersTemplateOutputActionBinder outputBinder = mOutputActionCPs[cp];
            TriggerBindInfo toremove = null;

            foreach (TriggerBindInfo b in outputBinder.TargetIDs)
            {
                if (b != null && other != null)
                {
                    if (b.LinkName == other.ToString())
                    {
                        toremove = b;
                    }
                }
                else
                {
                    CoreGlobals.getErrorManager().LogErrorToNetwork("(b.LinkName == other.ToString())");
                }
            }
            if (toremove != null)
            {
                outputBinder.TargetIDs.Remove(toremove);
            }
        }
コード例 #10
0
        static public void loadTerrainTileTypes()
        {
            if (mTerrainTileTypes != null)
            {
                return;
            }

            //load the XML file
            string fileName = CoreGlobals.getWorkPaths().mGameDataDirectory + @"\" + mTerrainTileTypeFileName;

            if (!File.Exists(fileName))
            {
                CoreGlobals.getErrorManager().OnSimpleWarning("Error loading terrain tile types.  Can't find " + fileName);
                return;
            }

            XmlSerializer s  = new XmlSerializer(typeof(TerrainTileTypes), new Type[] { typeof(TerrainTileType) });
            Stream        st = File.OpenRead(fileName);

            mTerrainTileTypes = (TerrainTileTypes)s.Deserialize(st);

            if (mTerrainTileTypes == null)
            {
                CoreGlobals.getErrorManager().OnSimpleWarning("No terrain tile types loaded check " + fileName);
            }
        }
コード例 #11
0
        static public bool launchApp()
        {
            ensureXFS();//ensure XFS is running before we try to launch the app.

            string consoleExe = getBestExe();

            if (consoleExe == "")
            {
                CoreGlobals.getErrorManager().OnSimpleWarning("Error quickviewing to 360 : No valid EXE file was found on the default console!");
                return(false);
            }

            try
            {
                string gameExe = mConsoleDir + "\\" + consoleExe;
                XenonInterface.mDefaultConsole.Reboot(gameExe, mConsoleDir, "", XboxRebootFlags.Title);
            }
            catch
            {
                CoreGlobals.getErrorManager().OnSimpleWarning("Error quickviewing to 360 : Could not reboot the box!!");
                return(false);
            }

            //allow a few sleep cycles so the game can boot up
            System.Threading.Thread.Sleep(3000);



            return(true);
        }
コード例 #12
0
        private void bakeFinalButton_Click(object sender, EventArgs e)
        {
            //check topic permission
            if (CoreGlobals.getEditorMain().mPhoenixScenarioEditor.CheckTopicPermission("Sim") == false)
            {
                return;
            }

            TriggerFinalBake.eBuildMode mode = TriggerFinalBake.eBuildMode.NoOptimizations;
            try
            {
                mode = (TriggerFinalBake.eBuildMode)Enum.Parse(typeof(TriggerFinalBake.eBuildMode), buildModeCombo.SelectedItem.ToString());
            }
            catch (System.Exception ex2)
            {
                CoreGlobals.getErrorManager().OnException(ex2);
            }

            //export
            string fileName = Path.Combine(CoreGlobals.ScenarioDirectory, CoreGlobals.ScenarioFile);

            if (TriggerFinalBake.eBuildMode.NoOptimizations == mode)
            {
                XMBProcessor.CreateXMB(fileName, false);
            }
            else
            {
                string tempFile = TriggerFinalBake.OptimizeScenarioScripts(fileName, mode);
                XMBProcessor.CreateXMB(tempFile, false);
                File.Copy(tempFile + ".xmb", fileName + ".xmb", true);
            }
        }
コード例 #13
0
        public string P4Cmd(string cmd, string arg, string inputPipe)
        {
            if (mbSetup == false)
            {
                if (Setup() == false)
                {
                    return("");
                }
            }
            string output = "";

            mLastError = "";
            try
            {
                PerforceLog(cmd + " " + arg);
                /// <summary> P4Cmd is a method in the Perforce class.
                /// <para> The firs string parameter is the standard P4 command, and the second string parameter contains all the arguments for that command.
                /// </summary>
                Process proc = new Process();
                proc.StartInfo.UseShellExecute        = false;
                proc.StartInfo.RedirectStandardOutput = true;
                proc.StartInfo.RedirectStandardInput  = true;
                proc.StartInfo.RedirectStandardError  = true;
                proc.StartInfo.CreateNoWindow         = true;
                proc.StartInfo.FileName  = @"p4.exe";
                proc.StartInfo.Arguments = (cmd + " " + arg);
                proc.Start();

                proc.StandardInput.Write(inputPipe);
                proc.StandardInput.Write("\r\n");
                proc.StandardInput.Close();
                //proc.WaitForExit();
                output = proc.StandardOutput.ReadToEnd();
                string errortext = proc.StandardError.ReadToEnd();
                PerforceLog("stdout: " + output);
                PerforceLog("stderr: " + mLastError);

                if (errortext.Length > 0)
                {
                    mLastError = errortext;
                }

                PerforceLog("stderr2: " + errortext);

                if (mbThrowStandardErrors && errortext.Length > 0)
                {
                    //CoreGlobals.getErrorManager().OnException()
                    throw new System.Exception("Perforce Error: (" + mLastError + ")");
                }
            }

            catch (System.Exception ex)
            {
                CoreGlobals.getErrorManager().OnSimpleWarning("error using perforce: " + ex.ToString());
            }

            return(output);
        }
コード例 #14
0
        public ErrorList()
        {
            InitializeComponent();


            myDelegate = new UpdateDel(UpdateInternal);

            label1.Text = "Error Log: " + CoreGlobals.getErrorManager().mErrorLog;
        }
コード例 #15
0
        private void Save()
        {
            try
            {
                if (mSavedFileName != "")
                {
                    XmlSerializer s  = new XmlSerializer(typeof(TriggerRoot), new Type[] { });
                    Stream        st = File.Open(mSavedFileName, FileMode.Create);

                    TriggerRoot root = TriggerData;
                    root.Name = Path.GetFileName(mSavedFileName);
                    root.Type = mType;
                    s.Serialize(st, root);
                    st.Close();

                    triggerHostArea1.Scan(true);

                    TriggerFinalBake.eBuildMode mode = TriggerFinalBake.eBuildMode.NoOptimizations;

                    try
                    {
                        mode = (TriggerFinalBake.eBuildMode)Enum.Parse(typeof(TriggerFinalBake.eBuildMode), buildMode.SelectedItem.ToString());
                    }
                    catch (System.Exception ex2)
                    {
                        CoreGlobals.getErrorManager().OnException(ex2);
                    }

                    //must have _raw_ tag for optimizations
                    if (mSavedFileName.Contains(TriggerFinalBake.sTriggerRaw) == false && TriggerFinalBake.eBuildMode.NoOptimizations != mode)
                    {
                        CoreGlobals.ShowMessage("filename not compatible with optimizations.");
                        mode = TriggerFinalBake.eBuildMode.NoOptimizations;
                    }

                    if (TriggerFinalBake.eBuildMode.NoOptimizations == mode)
                    {
                        XMBProcessor.CreateXMB(mSavedFileName, false);
                    }
                    else
                    {
                        string tempFile = TriggerFinalBake.OptimizeTriggerScript(mSavedFileName, mode);
                        XMBProcessor.CreateXMB(tempFile, false);

                        //File.Copy(tempFile + ".xmb", mSavedFileName + ".xmb", true);
                    }
                }
                else
                {
                    SaveAs();
                }
            }
            catch (System.Exception ex)
            {
                CoreGlobals.getErrorManager().OnException(ex);
            }
        }
コード例 #16
0
        public WorldObjectList()
        {
            InitializeComponent();
            TypeComboBox.SelectedIndex = 0;
            listView1.MouseDown       += new MouseEventHandler(listView1_MouseDown);
            listView1.MouseUp         += new MouseEventHandler(listView1_MouseUp);

            this.betterPropertyGrid1.AddMetaDataForProps("LightXML", new string[] { "Position", "Rotation", "Direction" }, "Ignore", true);
            this.betterPropertyGrid1.AddMetaDataForProps("SimObjectData", new string[] { "Position", "Rotation" }, "Ignore", true);
            this.betterPropertyGrid1.AddMetaDataForProps("PlayerPositionXML", new string[] { "Position", "Rotation", "Forward" }, "Ignore", true);
            this.betterPropertyGrid1.AddMetaDataForProps("HelperAreaObject", new string[] { "Position", "Direction", "Color" }, "Ignore", true);
            this.betterPropertyGrid1.AddMetaDataForProps("HelperAreaBoxObject", new string[] { "Position", "Direction", "Color" }, "Ignore", true);
            this.betterPropertyGrid1.AddMetaDataForProps("GameDesignValueSphere", new string[] { "Position", "XMLColor" }, "Ignore", true);
            this.betterPropertyGrid1.AddMetaDataForProp("SimObjectData", "ID", "ReadOnly", true);
            this.betterPropertyGrid1.AddMetaDataForProp("HelperAreaObject", "ID", "ReadOnly", true);
            this.betterPropertyGrid1.AddMetaDataForProp("HelperAreaBoxObject", "ID", "ReadOnly", true);


            this.betterPropertyGrid1.SetTypeEditor("SimObjectData", "Group", typeof(EnumeratedProperty));
            this.betterPropertyGrid1.SetTypeEditor("HelperAreaObject", "Group", typeof(EnumeratedProperty));
            this.betterPropertyGrid1.SetTypeEditor("HelperAreaBoxObject", "Group", typeof(EnumeratedProperty));
            this.betterPropertyGrid1.SetTypeEditor("GameDesignValueSphere", "Group", typeof(EnumeratedProperty));


            this.betterPropertyGrid1.AddMetaDataForProp("SimObjectData", "Department", "ReadOnly", true);
            this.betterPropertyGrid1.AddMetaDataForProp("SimObjectData", "Department", "StringIntEnumeration", EnumUtils.EnumToPairList(typeof(eDepartment)));
            this.betterPropertyGrid1.SetTypeEditor("SimObjectData", "Department", typeof(EnumeratedProperty));


            //this.betterPropertyGrid1.AddMetaDataForProp("GameDesignValueSphere", "ID", "ReadOnly", true);
            //this.betterPropertyGrid1.AddMetaDataForProp("GameDesignValueSphere", "DesignerData", "Ignore", true);
            this.betterPropertyGrid1.SetTypeEditor("GameDesignValueSphere", "DesignerData", typeof(DesignerDataEditorProperty));
            this.betterPropertyGrid1.AddMetaDataForProp("GameDesignValueSphere", "ID", "ReadOnly", true);
            this.betterPropertyGrid1.SetTypeEditor("GameDesignLine", "DesignerData", typeof(DesignerDataEditorProperty));
            this.betterPropertyGrid1.AddMetaDataForProp("GameDesignLine", "ID", "ReadOnly", true);
            this.betterPropertyGrid1.SetTypeEditor("GameDesignValuePoint", "DesignerData", typeof(DesignerDataEditorProperty));
            this.betterPropertyGrid1.AddMetaDataForProp("GameDesignValuePoint", "ID", "ReadOnly", true);

            this.betterPropertyGrid1.AddMetaDataForProp("SimObjectData", "TintValue", "Min", 0.0f);
            this.betterPropertyGrid1.AddMetaDataForProp("SimObjectData", "TintValue", "Max", 1.0f);



            //this.betterPropertyGrid1
            betterPropertyGrid1.AnyPropertyChanged += new ObjectEditorControl.PropertyChanged(betterPropertyGrid1_AnyPropertyChanged);


            try
            {
                FileStream f = new FileStream(CoreGlobals.getWorkPaths().mEditorSettings + "\\LocalLightUISettings.xml", FileMode.Open, FileAccess.Read);
                this.betterPropertyGrid1.LoadSettingsFromStream(f);
            }
            catch (System.Exception ex)
            {
                CoreGlobals.getErrorManager().SendToErrorWarningViewer(ex.ToString());
            }
        }
コード例 #17
0
        public void UpdateHelpText()
        {
            string newHelpText;

            List <object> paramsString = new List <object>();

            try
            {
                Dictionary <int, string> paramNames = new Dictionary <int, string>();

                foreach (TriggerParameterControl c in mParamcontrols)
                {
                    paramNames[c.GetVariable().SigID] = c.TextValue;
                }
                for (int i = 0; i < TriggerSystemDefinitions.cMaxParameters; i++)
                {
                    if (paramNames.ContainsKey(i) == false)
                    {
                        paramsString.Add("##ERRORPARAM=" + i.ToString());
                    }
                    else
                    {
                        paramsString.Add(paramNames[i]);
                    }
                }
            }
            catch (System.Exception ex)
            {
                CoreGlobals.getErrorManager().OnSimpleWarning(ex.ToString());
            }
            try
            {
                newHelpText           = string.Format(mDefinition.HelpText, paramsString.ToArray());
                this.HelpTextBox.Text = newHelpText;
            }
            catch (System.Exception ex)
            {
                this.HelpTextBox.Text = "#FORMAT ERROR:" + mDefinition.HelpText;
                CoreGlobals.getErrorManager().OnSimpleWarning(ex.ToString());
            }
            try
            {
                newHelpText = string.Format(mDefinition.Documentation, paramsString.ToArray());
                this.DocumentationTextBox.Text = newHelpText;
            }
            catch (System.Exception ex)
            {
                this.DocumentationTextBox.Text = "#FORMAT ERROR:" + mDefinition.Documentation;
                CoreGlobals.getErrorManager().OnSimpleWarning(ex.ToString());
            }
        }
コード例 #18
0
        /// <summary>
        /// Add a new binding target
        /// </summary>
        /// <param name="cp">This(starting) control point</param>
        /// <param name="other">Target control point</param>
        void output_ControlPointConnected(BasicControlPoint cp, IControlPoint other)
        {
            if (other.Virtual == true)
            {
                return;
            }
            //set target value:
            TriggerControl t = other.TagObject as TriggerControl;

            TriggersTemplateOutputActionBinder outputbinder = mOutputActionCPs[cp];

            if (t != null)
            {
                string name = cp.ToString();
                if (mOutputActionCPs.ContainsKey(cp))
                {
                    TriggerBindInfo bindInfo = new TriggerBindInfo();
                    bindInfo.SetTarget(t.Trigger.ID, other.ToString());
                    outputbinder.TargetIDs.Add(bindInfo);

                    return;
                }
            }

            TemplateControl templateControl = other.TagObject as TemplateControl;

            if (templateControl != null)
            {
                string name = other.ToString();
                foreach (TriggersTemplateInputActionBinder inputBinder in templateControl.TriggerTemplateMapping.TriggerInputs)
                {
                    if (inputBinder.Name == name)
                    {
                        foreach (TriggerBindInfo b in inputBinder.TargetIDs)
                        {
                            if (b.ID == templateControl.TriggerTemplateMapping.ID && b.LinkName == other.ToString())
                            {
                                CoreGlobals.getErrorManager().OnSimpleWarning("can't bind. template is already bound to trigger.  this is a bug");
                                return;
                            }
                        }

                        TriggerBindInfo bindInfo = new TriggerBindInfo();
                        bindInfo.SetTarget(templateControl.TriggerTemplateMapping.ID, other.ToString());
                        outputbinder.TargetIDs.Add(bindInfo);

                        return;
                    }
                }
            }
        }
コード例 #19
0
        public bool saveXML(string fileName)
        {
            if (!Monitor.TryEnter(this))
            {
                return(false);
            }
            try
            {
                if (fileName == "")
                {
                    return(false);
                }

                if (File.Exists(fileName))
                {
                    File.SetAttributes(fileName, FileAttributes.Normal);
                    File.Delete(fileName);
                }
                //if (File.Exists(fileName) && ((File.GetAttributes(fileName) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly))
                if (File.Exists(fileName) && ((File.GetAttributes(fileName) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly))
                {
                    MessageBox.Show(fileName + " is readonly.  please check it out");
                    LiveUpdateCheckBox.Checked = false;
                    return(false);
                }
                try
                {
                    //textBox1.Text = fileName;

                    //XmlSerializer s = new XmlSerializer(typeof(lightSetXML), new Type[] { });
                    //Stream st = File.Open(fileName, FileMode.OpenOrCreate);
                    //s.Serialize(st, mLightSet);
                    //st.Close();

                    SimGlobals.getSimMain().SaveScenarioLights(fileName, this.mLightSet);

                    return(true);
                }
                catch (System.Exception ex)
                {
                    CoreGlobals.getErrorManager().OnException(ex);
                    LiveUpdateCheckBox.Checked = false;
                }
            }
            finally
            {
                Monitor.Exit(this);
            }
            return(false);
        }
コード例 #20
0
 public void LoadData()
 {
     try
     {
         XmlSerializer s  = new XmlSerializer(typeof(TriggerDefinition), new Type[] { });
         Stream        st = File.OpenRead(mTriggerDefinitionFilename);
         mTriggerDefinition = (TriggerDefinition)s.Deserialize(st);
         st.Close();
     }
     catch (System.Exception ex)
     {
         CoreGlobals.getErrorManager().OnException(ex);
     }
 }
コード例 #21
0
        public void SaveData()
        {
            try
            {
                XmlSerializer s  = new XmlSerializer(typeof(TriggerDefinition), new Type[] { });
                Stream        st = File.Open(mTriggerDefinitionFilename, FileMode.Create);
                s.Serialize(st, mTriggerDefinition);
                st.Close();

                //Not used by game, no xmb needed
            }
            catch (System.Exception ex)
            {
                CoreGlobals.getErrorManager().OnException(ex);
            }
        }
コード例 #22
0
        public void Load()
        {
            try
            {
                XmlSerializer s  = new XmlSerializer(typeof(ScenarioDescriptionsXml), new Type[] { });
                Stream        st = File.OpenRead(mDescriptionFilename);
                mScenarioDescriptions = (ScenarioDescriptionsXml)s.Deserialize(st);
                st.Close();

                this.basicTypedSuperList1.ObjectList = mScenarioDescriptions.ScenarioInfoList;
            }
            catch (System.Exception ex)
            {
                CoreGlobals.getErrorManager().OnException(ex);
            }
        }
コード例 #23
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            try
            {
                XmlSerializer s  = new XmlSerializer(typeof(ScenarioDescriptionsXml), new Type[] { });
                Stream        st = File.Open(mDescriptionFilename, FileMode.Create);
                s.Serialize(st, mScenarioDescriptions);
                st.Close();

                XMBProcessor.CreateXMB(mDescriptionFilename, false);
            }
            catch (System.Exception ex)
            {
                CoreGlobals.getErrorManager().OnException(ex);
            }
        }
コード例 #24
0
        void mMaskPalette_mTextureSelected(int id)
        {
            try
            {
                TerrainGlobals.getTerrainFrontEnd().SelectedMaskIndex = id;

                //Todo cleaner way to access this window???
                if (MainWindow.mMainWindow.mBrushSettingsWindow != null)
                {
                    MainWindow.mMainWindow.mBrushSettingsWindow.Stroke = TerrainGlobals.getEditor().getCurrentStroke();
                }
            }
            catch (System.Exception ex)
            {
                CoreGlobals.getErrorManager().OnException(ex);
            }
        }
コード例 #25
0
 private void LoadFillSetttingsButton_Click(object sender, EventArgs e)
 {
     try
     {
         OpenFileDialog d = new OpenFileDialog();
         d.Filter = "Random Environment (*.renv)|*.renv";
         //d.InitialDirectory = GetInitialDirectory();
         if (d.ShowDialog() == DialogResult.OK)
         {
             mObjectPlacementSettings = ObjectPlacementSettingsFile.Load(d.FileName);
         }
     }
     catch (System.Exception ex)
     {
         CoreGlobals.getErrorManager().OnException(ex);
     }
 }
コード例 #26
0
        static public bool openConnection()
        {
            if (mXboxManager == null || mDefaultConsole == null)
            {
                init();
            }

            try
            {
                mCommandConnectionID = mDefaultConsole.OpenConnection(mCommandStringHandle);
            }
            catch
            {
                mCommandConnectionID = 0;
                CoreGlobals.getErrorManager().OnSimpleWarning("Error quickviewing to 360 : The game did not start properly. Please ensure XFS is running, and that you have the latest versions.");
            }

            return(true);
        }
コード例 #27
0
 private void SaveFillSettingsButton_Click(object sender, EventArgs e)
 {
     if (mObjectPlacementSettings.Count == 0)
     {
         return;
     }
     try
     {
         SaveFileDialog d = new SaveFileDialog();
         d.Filter = "Random Environment (*.renv)|*.renv";
         //d.InitialDirectory = pr
         if (d.ShowDialog() == DialogResult.OK)
         {
             ObjectPlacementSettingsFile.Save(d.FileName, mObjectPlacementSettings);
         }
     }
     catch (System.Exception ex)
     {
         CoreGlobals.getErrorManager().OnException(ex);
     }
 }
コード例 #28
0
        public void loadXML(string fileName)
        {
            try
            {
                textBox1.Text = fileName;


                //XmlSerializer s = new XmlSerializer(typeof(lightSetXML), new Type[] { });
                //Stream st = File.OpenRead(fileName);
                //mLightSet = (lightSetXML)s.Deserialize(st);
                //st.Close();

                mLightSet = SimGlobals.getSimMain().LoadScenarioLights(fileName, true);

                this.betterPropertyGrid1.SelectedObject = mLightSet;
            }
            catch (System.Exception ex)
            {
                CoreGlobals.getErrorManager().OnException(ex);
            }
        }
コード例 #29
0
        private void ExportButton_Click(object sender, EventArgs e)
        {
            try
            {
                SaveFileDialog d = new SaveFileDialog();
                d.Filter           = "Script (*" + CoreGlobals.getWorkPaths().mScriptExtention + ")|*" + CoreGlobals.getWorkPaths().mScriptExtention;
                d.InitialDirectory = CoreGlobals.getWorkPaths().mScriptTriggerDirectory;
                if (d.ShowDialog() == DialogResult.OK)
                {
                    XmlSerializer s  = new XmlSerializer(typeof(TriggerRoot), new Type[] { });
                    Stream        st = File.Open(d.FileName, FileMode.Create);
                    s.Serialize(st, TriggerData);
                    st.Close();

                    //game does not need this xmb at this point in time
                }
            }
            catch (System.Exception ex)
            {
                CoreGlobals.getErrorManager().OnException(ex);
            }
        }
コード例 #30
0
 private void SaveButton_Click(object sender, EventArgs e)
 {
     if (saveAsName == "")
     {
         SaveAsTemplate();
     }
     else
     {
         try
         {
             XmlSerializer s  = new XmlSerializer(typeof(TriggerTemplateDefinition), new Type[] { });
             Stream        st = File.Open(saveAsName, FileMode.Create);
             s.Serialize(st, TemplateDefinition);
             st.Close();
             triggerHostArea1.Scan(true);
         }
         catch (System.Exception ex)
         {
             CoreGlobals.getErrorManager().OnException(ex);
         }
     }
 }