Exemplo n.º 1
0
        internal bool SaveScript()
        {
            if (ScriptInfo.HalIPAddress != null)
            {
                Sys ho = new Sys(ScriptInfo.HalIPAddress);
                if (ScriptInfo.SourceFile == null)
                {
                    //new file..
                    using (frmSaveDialog dlg = new frmSaveDialog()) {
                        if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            ScriptInfo.SourceFile = dlg.textBox1.Text;
                        }
                    }
                }

                //try to save
                object retval = ho.PutScript(ScriptInfo.SourceFile, ScriptInfo.ModifiedScript);
                if ((bool)retval == true)
                {
                    return(true);                      //ok
                }
                if (retval.ToString() != "")
                {
                    throw new Exception(retval.ToString());
                }
            }

            return(false);
        }
Exemplo n.º 2
0
        internal bool SaveScript()
        {
            if (ScriptInfo.HalIPAddress != null) {
                Sys ho = new Sys(ScriptInfo.HalIPAddress);
                if (ScriptInfo.SourceFile == null) {
                    //new file..
                    using (frmSaveDialog dlg = new frmSaveDialog()) {
                        if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
                            ScriptInfo.SourceFile = dlg.textBox1.Text;
                        }
                    }
                }

                //try to save
                object retval = ho.PutScript(ScriptInfo.SourceFile, ScriptInfo.ModifiedScript);
                if ((bool)retval == true) return true; //ok

                if (retval.ToString() != "")
                    throw new Exception(retval.ToString());
            }

            return false;
        }