コード例 #1
0
ファイル: MainForm.cs プロジェクト: tyranid/canape
        private void NewDocument(bool fromTemplate)
        {
            if (!CheckDirtyFlag())
            {
                CANAPETemplate template = null;

                if (fromTemplate)
                {
                    using (SelectProjectTemplateForm frm = new SelectProjectTemplateForm())
                    {
                        if (frm.ShowDialog(this) == DialogResult.OK)
                        {
                            template = frm.Template;
                        }
                    }
                }

                CANAPEProject.New();
                InitializeTree();
                SetTitle(null);

                if (template != null)
                {
                    try
                    {
                        // Allow insecure load, if someone has added a template they could just add a plugin
                        CANAPEProject.Load(template.GetStream(), null, true, false);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(this, ex.Message, Properties.Resources.MessageBox_ErrorString,
                                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }

                IProxyClientFactory client = (IProxyClientFactory)GeneralUtils.StringToObject(Properties.Settings.Default.ProxyClient);
                if (client != null)
                {
                    try
                    {
                        CANAPEProject.CurrentProject.DefaultProxyClient = client;
                    }
                    catch (ArgumentException)
                    {
                        CANAPEProject.CurrentProject.DefaultProxyClient = new IpProxyClientFactory();
                    }
                }

                OnProjectChanged();
            }
        }
コード例 #2
0
 static void Main(string[] args)
 {
     foreach (string file in args)
     {
         foreach (string f in Directory.GetFiles(Environment.CurrentDirectory, file))
         {
             try
             {
                 Console.WriteLine("Processing {0}", f);
                 CANAPEProject.Load(f, false, true);
                 CANAPEProject.Save(f, false, false);
             }
             catch
             {
             }
         }
     }
 }