Esempio n. 1
0
        public async Task PrefixAsyc([Remainder] string args = null)
        {
            bool check = this.ReadChannelGeneralAdmin();

            if (!check)
            {
                return;
            }

            if (args != null)
            {
                string[] countArgs = args.Split(' ');

                if (countArgs.Length != 1)
                {
                    await this.SendToGeneralChannelAdminAsync("Zu viele Agumente! Bitte `" + Prefix + "prefix <prefix>` angeben.");
                }
                else if (countArgs[0].Length > 1)
                {
                    await this.SendToGeneralChannelAdminAsync("Der Prefix ist zu lang. Nur ein Zeichen!");
                }
                else
                {
                    ConfigXML config = new ConfigXML();
                    config.ChangePrefix(countArgs[0][0]);
                    await this.SendToGeneralChannelAdminAsync("Der Prefix wurde zu `" + countArgs[0][0] + "` geändert!");

                    await this.SendToGeneralChannelAdminAsync("> Info: Der Befehl brauch ein `" + this.Prefix + "restart`");
                }
            }
            else
            {
                await this.SendToGeneralChannelAdminAsync("Du hast zu wenig Argumente angebene. Bitte nutze den Befehl wie folgt: `" + Prefix + "prefix <prefix>`");
            }
        }
Esempio n. 2
0
        private void bw_loadXML_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            string dt_name = "Dungeon Teller.exe";

            if (File.Exists(dt_name))
            {
                string dt_version = ConfigXML.getDtVersion();

                if (this.update.tool_version != dt_version)
                {
                    invokeUpdate();
                }
                else
                {
                    MessageBox.Show("Dungeon Teller is already up to date.", "Updater", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Application.Exit();
                }
            }
            else
            {
                DialogResult result = MessageBox.Show(String.Format("{0} not found! Do you want to download it?", dt_name), "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == DialogResult.Yes)
                {
                    invokeUpdate();
                }
                else
                {
                    Application.Exit();
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Displays the icon in the system tray.
        /// </summary>
        public void Display()
        {
            // Put the icon in the system tray and allow it react to mouse clicks.
            ni.MouseClick += new MouseEventHandler(ni_MouseClick);
            ni.Icon        = Resources.clock1;
            ni.Text        = "GMT+0 : " + DateTime.Now.ToUniversalTime().ToString("HH:mm:ss");
            ni.Visible     = true;


#if !DEBUG
            ni.BalloonTipIcon  = ToolTipIcon.Info;
            ni.BalloonTipTitle = ConfigHelper.RetornaVersao();
            ni.BalloonTipText  = "Aplicativo de relógios iniciado";
            ni.ShowBalloonTip(1500);
#endif

            // Attach a context menu.
            ni.ContextMenuStrip = new ContextMenus().Create();

            ConfigXML configXML = ConfigHelper.CarregarConfig();

            foreach (RelogioXML relogio in configXML.Relogios)
            {
                formRelogio form = new formRelogio();
                form.relogioXML = relogio;
                form.Show();
            }
        }
Esempio n. 4
0
        public static ConfigXML CarregarConfig()
        {
            XmlParseHelper <ConfigXML> xmlParse = new XmlParseHelper <ConfigXML>();

            ConfigXML configXml = xmlParse.LoadData(ArquivoConfig);

            return(configXml);
        }
Esempio n. 5
0
        public static void SalvarConfig(ConfigXML configXML)
        {
            configXML.Versao = RetornaVersao();


            XmlParseHelper <ConfigXML> xmlParse = new XmlParseHelper <ConfigXML>();

            xmlParse.SaveData(ArquivoConfig, configXML);
        }
Esempio n. 6
0
        public OpenKMAddIn()
        {
            // Initialize vars;
            configXML = new ConfigXML();
            docXML    = new DocumentXML();
            fileUtil  = new FileUtil();

            // Initialize forms
            configurationForm = new ConfigurationForm();
        }
Esempio n. 7
0
        /// <summary>
        /// 設定XML生成
        /// </summary>
        private void InitializeConfig()
        {
            // 設定インスタンス
            ConfigXML oConfigXML = new ConfigXML();

            // 画面初期化
            oConfigXML.setDefaultData();
            // 画面設定値設定
            oConfigXML.setSettingData();
        }
Esempio n. 8
0
        public ExplorerForm(Object application, String formType, ConfigXML configXML, DocumentXML docXML)
        {
            try
            {
                resources = new ComponentResourceManager(typeof(ExplorerForm));

                this.application = application;
                this.formType    = formType;
                imageList        = new ImageUtil();
                this.configXML   = configXML;
                this.documentXML = docXML;

                // Initialize component
                InitializeComponent();

                // Centering form
                this.CenterToParent();

                // Column translations
                dataGridView.Columns[0].HeaderText = "";
                dataGridView.Columns[1].HeaderText = "";
                dataGridView.Columns[2].HeaderText = "";
                dataGridView.Columns[3].HeaderText = resources.GetString("name");
                dataGridView.Columns[4].HeaderText = resources.GetString("author");
                dataGridView.Columns[5].HeaderText = resources.GetString("version");
                dataGridView.Columns[6].HeaderText = resources.GetString("date");

                // Translations
                edit.Text   = resources.GetString("edit");
                cancel.Text = resources.GetString("cancel");
                this.Text   = resources.GetString("documentexplorer");

                // By default edit button is always disabled
                edit.Enabled = false;

                // Setting the image list
                tree.ImageList = imageList.get();

                // Grid user properties
                dataGridView.AllowUserToAddRows      = false;
                dataGridView.AllowUserToDeleteRows   = false;
                dataGridView.AllowUserToOrderColumns = false;
                dataGridView.MultiSelect             = false;
                dataGridView.SelectionMode           = DataGridViewSelectionMode.FullRowSelect;

                // Adding click handlers
                tree.NodeMouseClick    += new TreeNodeMouseClickEventHandler(nodeMouseClick);
                dataGridView.CellClick += new DataGridViewCellEventHandler(dataGridView_CellClick);
            }
            catch (Exception e)
            {
                String errorMsg = "ExplorerForm - (ExplorerForm)\n" + e.Message + "\n\n" + e.StackTrace;
                MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Esempio n. 9
0
        private void invokeUpdate()
        {
            Directory.CreateDirectory("temp");
            ConfigXML.writeLocal <UpdateXML>(update, "temp\\update.xml");
            foreach (string newPath in Directory.GetFiles("libs", "*.*"))
            {
                File.Copy(newPath, newPath.Replace("libs", "temp"), true);
            }

            Restarter.restart("update");
        }
        public CommandHandlingService()
        {
            ConfigXML configXML   = new ConfigXML();
            var       config      = configXML.LoadConfigXML();
            var       prefixQuery = from pre in config.Descendants("General")
                                    select pre;

            foreach (var item in prefixQuery)
            {
                this._prefix = item.Element("Prefix").Value[0];
            }
        }
Esempio n. 11
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (ConfigXML.AccessAllow(NTT.Web.Core.Security.Cryto.MD5(this.txt_conf.Text)))
     {
         ConfigXML.BuildXMLFile("config.xml", this.Txt_Server.Text, this.txt_db.Text, this.txt_uid.Text, this.txt_pwd.Text);
         this.lb_mess.Text = "Đã lưu cấu hình";
     }
     else
     {
         this.lb_mess.Text = "Mật khẩu cấu hình không đúng";
     }
 }
Esempio n. 12
0
        public ConfigurationForm()
        {
            resources = new ComponentResourceManager(typeof(ConfigurationForm));
            InitializeComponent();
            this.Text = resources.GetString("configuration");
            this.CenterToParent();
            ConfigXML configXML = new ConfigXML();

            textBoxHost.Text     = configXML.getHost();
            textBoxUserName.Text = configXML.getUser();
            textBoxPassword.Text = configXML.getPassword();
        }
Esempio n. 13
0
        public AddinModule()
        {
            InitializeComponent();
            configXML   = new ConfigXML();
            openkmAddin = new OpenKMAddIn();

            // Internacionalitzation
            this.import.Caption    = resources.GetString("import");
            this.configure.Caption = resources.GetString("configure");

            // Please add any initialization code to the AddinInitialize event handler
            this.import.Click    += new AddinExpress.MSO.ADXClick_EventHandler(import_Click);
            this.configure.Click += new AddinExpress.MSO.ADXClick_EventHandler(configure_Click);
        }
Esempio n. 14
0
        /// <summary>
        /// 既定値ボタン押下
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDefalt_Click(object sender, EventArgs e)
        {
            // 初期化
            ConfigXML oConfigData = new ConfigXML();

            // 設定値初期化
            oConfigData.setDefaultData();
            // 背景色再設定
            oConfigData.setSettingData();
            // 設定XML出力
            oXMLProcess.fStreamXML("CONFIG", oXMLProcess.outConfigXml);
            // 設定反映メッセージ
            MessageBox.Show("設定が反映されました。");
        }
Esempio n. 15
0
        /// <summary>
        /// コンフィグXML出力
        /// </summary>
        /// <param name="sFullPath"></param>
        public void outConfigXml(string sFullPath)
        {
            // アクセス設定情報を設定
            ConfigXML oConfig = new ConfigXML();

            // ファイルを開く
            using (StreamWriter lStreamWriter = new StreamWriter(sFullPath, false, new UTF8Encoding(false)))
            {
                // アクセス用のXmlSirializerの作成
                XmlSerializer lXMLSerializer = new XmlSerializer(typeof(ConfigXML));
                // アクセス情報をシリアル化してXMLに出力
                lXMLSerializer.Serialize(lStreamWriter, oConfig);
            }
        }
Esempio n. 16
0
    private void createCanvas(ConfigXML config, GameObject views)
    {
        foreach (var canva in config.Canvas)
        {
            GameObject gameObjectParent = new GameObject();
            gameObjectParent.name = canva.id;
            gameObjectParent.transform.SetParent(views.transform);
            gameObjectParent.AddComponent <RectTransform>();

            GameObject gameObjectCanvas = new GameObject();
            gameObjectCanvas.name = "UIContainer";
            gameObjectCanvas.transform.SetParent(gameObjectParent.transform);
            Canvas cv = gameObjectCanvas.AddComponent <Canvas>();
            cv.planeDistance = canva.planeDistance;
            cv.sortingOrder  = canva.order;
            canvas           = gameObjectCanvas.GetComponent <Canvas>();
            gameObjectCanvas.AddComponent <CanvasScaler>();
            gameObjectCanvas.AddComponent <GraphicRaycaster>();

            if (canva.renderMode == "ScreenSpaceOverlay")
            {
                canvas.renderMode = RenderMode.ScreenSpaceOverlay;
            }
            else if (canva.renderMode == "ScreenSpaceCamera")
            {
                canvas.renderMode  = RenderMode.ScreenSpaceCamera;
                canvas.worldCamera = Camera.main;
            }
            else if (canva.renderMode == "WorldSpace")
            {
                canvas.renderMode = RenderMode.WorldSpace;
            }

            CanvasScaler canvasScaler = gameObjectCanvas.GetComponent <CanvasScaler>();
            canvasScaler.uiScaleMode = CanvasScaler.ScaleMode.ConstantPixelSize;

            RectTransform rectCanvas = gameObjectCanvas.GetComponent <RectTransform>();
            rectCanvas.localScale = Vector2.one;
            rectCanvas.pivot      = Vector2.zero;

            canvasList.Add(gameObjectCanvas);
        }
        // Create eventSystem
        GameObject eventSystemObject = new GameObject();

        eventSystemObject.name = "EventSystem";
        eventSystemObject.AddComponent <EventSystem>();
        eventSystemObject.AddComponent <StandaloneInputModule>();
    }
Esempio n. 17
0
        /// <summary>
        /// コンフィグXML読込
        /// </summary>
        /// <param name="sFullPath"></param>
        public void redConfigXml(string sFullPath)
        {
            // 画面設定情報を設定
            ConfigXML oConfig = new ConfigXML();

            // ファイルを開く
            using (StreamReader lStreamReader = new StreamReader(sFullPath, new UTF8Encoding(false)))
            {
                // 画面設定のXmlSirializerの作成
                XmlSerializer lXMLSerializer = new XmlSerializer(typeof(ConfigXML));
                // 画面設定情報をデシリアライズ
                oConfig = (ConfigXML)lXMLSerializer.Deserialize(lStreamReader);
                // 設定値の設定
                oConfig.setSettingData();
            }
        }
Esempio n. 18
0
        private void workerLoadUpdateXml_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (update != null)
            {
                if (update.msg != "")
                {
                    MessageBox.Show(update.msg, "Dungeon Teller - Info Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                if (update.tool_version != Application.ProductVersion)
                {
                    this.Hide();
                    DialogResult UpgradeToolDialog = updater.ShowDialog(UpdateState.UpgradeTool, update.tool_version);

                    if (UpgradeToolDialog == DialogResult.Yes)
                    {
                        Directory.CreateDirectory("temp");
                        ConfigXML.writeLocal <UpdateXML>(update, "temp\\update.xml");
                        foreach (string newPath in Directory.GetFiles("libs", "*.*"))
                        {
                            File.Copy(newPath, newPath.Replace("libs", "temp"), true);
                        }

                        if (!File.Exists("Updater.exe") || FileVersionInfo.GetVersionInfo("Updater.exe").ProductVersion != update.updater_version)
                        {
                            this.lbl_status.Text = "Updating the updater ...";
                            this.Show();
                            workerLoadUpdater.RunWorkerAsync();
                        }
                        else
                        {
                            UpdateStarter.start("update");
                            Application.Exit();
                        }
                    }
                    else
                    {
                        checkOffsets();
                    }
                }
                else
                {
                    checkOffsets();
                }
            }
        }
Esempio n. 19
0
        public static void SalvarRelogio(RelogioXML relogioXML)
        {
            ConfigXML configXML = CarregarConfig();

            if (configXML == null)
            {
                configXML = new ConfigXML();
            }

            RelogioXML relogioExiste = configXML.Relogios.Where(x => x.Sigla == relogioXML.Sigla).FirstOrDefault();

            if (relogioExiste != null)
            {
                configXML.Relogios.Remove(relogioExiste);
            }

            configXML.Relogios.Add(relogioXML);

            SalvarConfig(configXML);
        }
Esempio n. 20
0
        public static void ExcluirRelogio(RelogioXML relogioXML)
        {
            ConfigXML configXML = CarregarConfig();

            if (configXML == null)
            {
                return;
            }


            RelogioXML relogioExiste = configXML.Relogios.Where(x => x.Sigla == relogioXML.Sigla).FirstOrDefault();

            if (relogioExiste != null)
            {
                configXML.Relogios.Remove(relogioExiste);
            }


            SalvarConfig(configXML);
        }
Esempio n. 21
0
        public TreeForm(Object application, ConfigXML configXML)
        {
            try
            {
                resources = new ComponentResourceManager(typeof(TreeForm));

                this.application = application;
                this.configXML   = configXML;
                imageList        = new ImageUtil();

                // Initialize component
                InitializeComponent();

                // Centering form
                this.CenterToParent();

                // Translations
                accept.Text = resources.GetString("accept");
                cancel.Text = resources.GetString("cancel");
                this.Text   = resources.GetString("treenavigator");

                // By default accept button is always disabled
                accept.Enabled = false;

                // Setting the image list
                tree.ImageList = imageList.get();

                // Adding click handler
                treeNodeMouseClickEventHandler = new TreeNodeMouseClickEventHandler(nodeMouseClick);
                tree.NodeMouseClick           += treeNodeMouseClickEventHandler;
            }
            catch (Exception e)
            {
                String errorMsg = "TreeForm - (TreeForm)\n" + e.Message + "\n\n" + e.StackTrace;
                MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Esempio n. 22
0
        private void buttonAccept_Click(object sender, EventArgs e)
        {
            bool   error    = false;
            String errorTXT = "";

            if (textBoxUserName.Text.Equals(""))
            {
                error     = true;
                errorTXT += String.Format(resources.GetString("error"), resources.GetString("username")) + "\n";
            }

            if (textBoxPassword.Text.Equals(""))
            {
                error     = true;
                errorTXT += String.Format(resources.GetString("error"), resources.GetString("password")) + "\n";
            }

            if (textBoxHost.Text.Equals(""))
            {
                error     = true;
                errorTXT += String.Format(resources.GetString("error"), resources.GetString("host")) + "\n";
            }

            if (error)
            {
                MessageBox.Show(errorTXT, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                ConfigXML configXML = new ConfigXML();
                configXML.setHost(textBoxHost.Text);
                configXML.setUser(textBoxUserName.Text);
                configXML.setPassword(textBoxPassword.Text);
                configXML.CreateConfigurationFile();
                this.Hide();
            }
        }
Esempio n. 23
0
    protected void btnTest_Click(object sender, EventArgs e)
    {
        if (ConfigXML.AccessAllow(NTT.Web.Core.Security.Cryto.MD5(this.txt_conf.Text)))
        {
            //ConfigXML.BuildConfigFile("tmpdbconfig.xml", this.Txt_Server.Text, this.txt_db.Text, this.txt_uid.Text, this.txt_pwd.Text);

            StringBuilder sb = new StringBuilder();
            sb.Append("Server=").Append(this.Txt_Server.Text).Append(";");
            sb.Append("Database=").Append(this.txt_db.Text).Append(";");
            //sb.Append("Integrated Security=SSPI;");
            sb.Append("uid=").Append(this.txt_uid.Text).Append(";");
            sb.Append("pwd=").Append(this.txt_pwd.Text).Append(";");
            sb.Append("Connect Timeout=30");

            string     connection_string = sb.ToString();
            DataObject con = new DataObject(connection_string, false);
            try
            {
                if (con.TestConnection())
                {
                    this.lb_mess.Text = "Kết nối thành công";
                }
                else
                {
                    this.lb_mess.Text = "Không thể kết nối!!!";
                }
            }
            catch (Exception E)
            {
                this.lb_mess.Text = E.Message;
            }
        }
        else
        {
            this.lb_mess.Text = "Mật khẩu cấu hình không đúng";
        }
    }
Esempio n. 24
0
    // Use this for initialization
    public void Init(GameObject views)
    {
        XmlSerializer serializer = new XmlSerializer(typeof(ConfigXML));

        using (Stream reader = new FileStream(Application.dataPath + "/../" + configPath, FileMode.Open))
        {
            // Call the Deserialize method to restore the object's state.
            config = (ConfigXML)serializer.Deserialize(reader);
        }
        if (config == null)
        {
            Application.Quit();
        }

        // Load image
        MediaLoader mediaLoader = new MediaLoader(config.mediaPath);

        // TEST LOAD FONT

        /*WWW fontwww = new WWW(Application.dataPath + "../../resources/NewJune-Bold.otf");
         * //Font font = fontwww.bytes as Font;
         * Font font = new Font();
         *
         * string[] fonts = Font.GetOSInstalledFontNames();
         * foreach (string fontName in fonts)
         * {
         *  Debug.Log("fonts = " + fontName);
         * }*/

        // Create Canvas
        createCanvas(config, views);

        init();

        BroadcastMessage("UiFinishedLoading", SendMessageOptions.DontRequireReceiver);
    }
Esempio n. 25
0
        public void ImportMail(Outlook.Explorers explorers, ConfigXML configXML)
        {
            ComponentResourceManager resources = new ComponentResourceManager(typeof(OpenKMAddIn));

            int mailCount  = 0;
            int mailAttach = 0;

            for (int y = 1; y <= explorers.Count; y++)
            {
                Outlook.Explorer openWindow        = explorers.Item(y);
                String           token             = "";
                OKMAuth          authService       = new OKMAuth(configXML.getHost());
                OKMFolder        folderService     = new OKMFolder(configXML.getHost());
                OKMRepository    repositoryService = new OKMRepository(configXML.getHost());
                OKMMail          mailService       = new OKMMail(configXML.getHost());
                OKMDocument      documentService   = new OKMDocument(configXML.getHost());

                try
                {
                    if (configXML.getUser().Equals("") || configXML.getPassword().Equals("") ||
                        configXML.getHost().Equals(""))
                    {
                        throw new Exception(resources.GetString("error_configuration_empty"));
                    }

                    token = authService.login(configXML.getUser(), configXML.getPassword());

                    for (int i = 1; i <= openWindow.Selection.Count; i++)
                    {
                        Object selObject = openWindow.Selection.Item(i);
                        if (selObject is Outlook.MailItem)
                        {
                            mailCount++;
                            Outlook.MailItem mailItem     = (selObject as Outlook.MailItem);
                            DateTime         receivedTime = mailItem.ReceivedTime;
                            String           user         = configXML.getUser();
                            String           basePath     = "/okm:mail/" + user + "/";
                            String           year         = "" + receivedTime.Year;
                            String           month        = "" + receivedTime.Month;
                            String           day          = "" + receivedTime.Day;

                            // Only creating folders when it's needed
                            if (repositoryService.hasNode(token, basePath + year))
                            {
                                if (repositoryService.hasNode(token, basePath + year + "/" + month))
                                {
                                    if (!repositoryService.hasNode(token, basePath + year + "/" + month + "/" + day))
                                    {
                                        folder dayFolder = new folder();
                                        dayFolder.path = basePath + year + "/" + month + "/" + day;
                                        folderService.create(token, dayFolder);
                                    }
                                }
                                else
                                {
                                    folder monthFolder = new folder();
                                    folder dayFolder   = new folder();
                                    monthFolder.path = basePath + year + "/" + month;
                                    dayFolder.path   = basePath + year + "/" + month + "/" + day;
                                    folderService.create(token, monthFolder);
                                    folderService.create(token, dayFolder);
                                }
                            }
                            else
                            {
                                folder yearFolder  = new folder();
                                folder monthFolder = new folder();
                                folder dayFolder   = new folder();
                                yearFolder.path  = basePath + year;
                                monthFolder.path = basePath + year + "/" + month;
                                dayFolder.path   = basePath + year + "/" + month + "/" + day;
                                folderService.create(token, yearFolder);
                                folderService.create(token, monthFolder);
                                folderService.create(token, dayFolder);
                            }

                            // Adding mail values
                            mail newMail = new mail();
                            newMail.path    = basePath + year + "/" + month + "/" + day + "/" + mailItem.Subject;
                            newMail.subject = mailItem.Subject;

                            newMail.from = mailItem.GetType().InvokeMember("SenderEmailAddress", System.Reflection.BindingFlags.GetProperty, null, mailItem, null).ToString();
                            //newMail.from = mailItem.SenderEmailAddress; // SenderEmailAddress was introduced in outlook 2002
                            newMail.sentDate              = mailItem.SentOn;
                            newMail.sentDateSpecified     = true;
                            newMail.receivedDate          = mailItem.ReceivedTime;
                            newMail.receivedDateSpecified = true;

                            // Setting mail context and type

                            BodyFormat format = (BodyFormat)mailItem.GetType().InvokeMember("BodyFormat", System.Reflection.BindingFlags.GetProperty, null, mailItem, null);
                            if (format.Equals(BodyFormat.olFormatPlain))
                            {
                                newMail.mimeType = "text/plain";
                                newMail.content  = mailItem.Body;
                            }
                            else
                            {
                                newMail.mimeType = "text/html";
                                newMail.content  = mailItem.HTMLBody;
                            }

                            // Initialize count recipient address variables
                            int count          = 0;
                            int countTo        = 0;
                            int countCC        = 0;
                            int countBCC       = 0;
                            int actualCountTo  = 0;
                            int actualCountCC  = 0;
                            int actualCountBCC = 0;

                            // Count each mail addresss type to / cc / bcc
                            for (int x = 1; x <= mailItem.Recipients.Count; x++)
                            {
                                Outlook.Recipient recipient = mailItem.Recipients.Item(x);
                                switch (recipient.Type)
                                {
                                case 1:
                                    countTo++;
                                    break;

                                case 2:
                                    countCC++;
                                    break;

                                case 3:
                                    countBCC++;
                                    break;

                                default:
                                    countTo++;
                                    break;
                                }
                                count++;
                            }

                            // Initialize variables
                            String[] mailTo  = new String[(countTo > 0) ? countTo : 1];
                            String[] mailCC  = new String[(countCC > 0) ? countCC : 1];
                            String[] mailBCC = new String[(countBCC > 0) ? countBCC : 1];

                            // All string[] must have at least one value, it¡s mandatory in webservices
                            if (countTo == 0)
                            {
                                mailTo[0] = "";
                            }
                            if (countCC == 0)
                            {
                                mailCC[0] = "";
                            }
                            if (countBCC == 0)
                            {
                                mailBCC[0] = "";
                            }

                            // Depending mail type each mail is assignede to it own type String[]
                            for (int x = 1; x <= mailItem.Recipients.Count; x++)
                            {
                                Outlook.Recipient recipient = mailItem.Recipients.Item(x);
                                switch (recipient.Type)
                                {
                                case 1:
                                    mailTo[actualCountTo] = recipient.Address;
                                    actualCountTo++;
                                    break;

                                case 2:
                                    mailCC[actualCountCC] = recipient.Address;
                                    actualCountCC++;
                                    break;

                                case 3:
                                    mailBCC[actualCountBCC] = recipient.Address;
                                    actualCountBCC++;
                                    break;

                                default:
                                    mailTo[actualCountTo] = recipient.Address;
                                    actualCountTo++;
                                    break;
                                }
                            }

                            // Assign mail recipients by type
                            newMail.bcc = mailBCC;
                            newMail.cc  = mailCC;
                            newMail.to  = mailTo;

                            // Creating mail
                            newMail = mailService.create(token, newMail);

                            // Setting attachments
                            if (mailItem.Attachments.Count > 0)
                            {
                                for (int x = 1; x <= mailItem.Attachments.Count; x++)
                                {
                                    Outlook.Attachment attachment = mailItem.Attachments.Item(x);

                                    mailAttach++;
                                    document doc = new document();
                                    doc.path = newMail.path + "/" + attachment.FileName;

                                    // save as tempfile for reading
                                    String filename = Environment.GetEnvironmentVariable("TEMP") + "\\" + DateTime.Now.ToString("yymmddHHMMss-") + attachment.FileName;
                                    // save the attachment
                                    attachment.SaveAsFile(filename);

                                    // Uploading document
                                    documentService.create(token, doc, ReadFile(filename));

                                    // Delete a file by using File class static method...
                                    if (File.Exists(filename))
                                    {
                                        // Use a try block to catch IOExceptions, to
                                        // handle the case of the file already being
                                        // opened by another process.
                                        try
                                        {
                                            File.Delete(filename);
                                        }
                                        catch (System.IO.IOException ex)
                                        {
                                            MessageBox.Show(String.Format(resources.GetString("error_deleting_tmp_file"), filename, ex.Message), "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                        }
                                    }

                                    // Releasing com object
                                    Marshal.ReleaseComObject(attachment);
                                }
                            }

                            // Releasing com object
                            Marshal.ReleaseComObject(mailItem);
                        }

                        // Releasing com object
                        Marshal.ReleaseComObject(selObject);
                    }

                    if (!token.Equals(""))
                    {
                        authService.logout(token);  // Always we logout
                        token = "";                 // Reseting token value
                    }

                    if (mailCount > 0)
                    {
                        MessageBox.Show(String.Format(resources.GetString("email_successful_imported"), mailCount, mailAttach));
                    }
                    else
                    {
                        MessageBox.Show(resources.GetString("error_mail_not_selected"), "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    if (!token.Equals(""))
                    {
                        authService.logout(token); // Always we logout
                    }
                }
            }
        }
Esempio n. 26
0
        // Set ID in config File
        public async Task SetOutputID(string args, string commandname, string modul, string group, string modulID)
        {
            // need a argument
            if (args != null)
            {
                string[] countArgs = args.Split(' ');
                // check is exact one argument
                if (countArgs.Length != 1)
                {
                    await this.SendToGeneralChannelAdminAsync("Zu viele Agumente! Bitte `" + Prefix + commandname + " <channelid>` angeben.");
                }
                else
                {
                    ulong ulongID = Context.Channel.Id;
                    // if not only numbers return
                    try
                    {
                        ulongID = Convert.ToUInt64(args);
                    }
                    catch (Exception)
                    {
                        await this.SendToGeneralChannelAdminAsync("Die ID besteht nicht nur aus Zahlen!");

                        return;
                    }

                    // check if channel id exist
                    var  allChannel = Context.Guild.Channels;
                    var  allRoles   = Context.Guild.Roles;
                    bool exist      = false;
                    // Check all Channel IDs
                    foreach (var item in allChannel)
                    {
                        if (ulongID == item.Id)
                        {
                            exist = true;
                            break;
                        }
                    }
                    // Check all Roles IDs
                    foreach (var item in allRoles)
                    {
                        if (ulongID == item.Id)
                        {
                            exist = true;
                            break;
                        }
                    }
                    // id right ? change configXML : notice user channel doen't exist
                    if (exist || ulongID == 0)
                    {
                        ConfigXML config = new ConfigXML();

                        config.ChangeWriteIntoChannelID(ulongID, modul, modulID);
                        if (ulongID == 0)
                        {
                            if (modulID == "ModRoleID")
                            {
                                await this.SendToGeneralChannelAdminAsync("Die ModRole wurde zurück gesetzt.");
                            }
                            else
                            {
                                await this.SendToGeneralChannelAdminAsync("Der Channel wurde auf Standardeinstellung gesetzt.");

                                await this.SendToGeneralChannelAdminAsync("Ich Lese und Antworte jetzt immer im selben Channel.");
                            }
                        }
                        else
                        {
                            if (modulID == "ModRoleID")
                            {
                                await this.SendToGeneralChannelAdminAsync("Du hast die ModRole `" + Context.Guild.GetRole(ulongID) + "` gesetzt");
                            }
                            else
                            {
                                await this.SendToGeneralChannelAdminAsync("Der Channel `" + Context.Guild.GetChannel(ulongID).Name +
                                                                          "` wurde für das Modul `" + modul + " " + group + "` gesetzt.");
                            }
                        }
                    }
                    else
                    {
                        await this.SendToGeneralChannelAdminAsync("Diese ID existiert nicht.");
                    }
                }
            }
            else
            {
                await this.SendToGeneralChannelAdminAsync("Du hast zu wenig Argumente angebene. Bitte nutze den Befehl wie folgt: `" + Prefix + commandname + " <channelid>`");
            }
        }
Esempio n. 27
0
    public void displayFormBuilderPalette(IFormConfiguration formConfig)
    {
        // Make a background box
        GUI.Box(new Rect(10, 10, 700, 590), "Builder Palette");

        bool displayStarfishControls  = false;
        bool displayLoxodromeControls = false;
        bool displayRingControls      = false;

        if (formConfig.getFormProcessor().GetType() == typeof(StarfishForm))
        {
            displayStarfishControls = true;
        }
        else if (formConfig.getFormProcessor().GetType() == typeof(LoxodromeForm))
        {
            displayLoxodromeControls = true;
        }
        else if (formConfig.getFormProcessor().GetType() == typeof(RingForm))
        {
            displayRingControls = true;
        }

        /* TRUNK */

        //start position
        Vector3 startPosition = formConfig.getStartPosition();

        startPositionX = startPosition.x;
        startPositionY = startPosition.y;
        startPositionZ = startPosition.z;

        GUI.Label(new Rect(20, 40, 150, 20), "Trunk Start Position X");
        startPositionX = GUI.HorizontalSlider(new Rect(180, 45, 180, 20), startPositionX, -5, 5);

        GUI.Label(new Rect(20, 70, 150, 20), "Trunk Start Position Y");
        startPositionY = GUI.HorizontalSlider(new Rect(180, 75, 180, 20), startPositionY, -5, 5);

        GUI.Label(new Rect(20, 100, 150, 20), "Trunk Start Position Z");
        startPositionZ = GUI.HorizontalSlider(new Rect(180, 105, 180, 20), startPositionZ, -5, 5);

        startPosition.x = startPositionX;
        startPosition.y = startPositionY;
        startPosition.z = startPositionZ;
        formConfig.setStartPosition(startPosition);

        // start rotation
        Vector3 startRotation = formConfig.getStartRotation();

        startRotationX = startRotation.x;
        startRotationY = startRotation.y;
        startRotationZ = startRotation.z;

        if (displayLoxodromeControls)
        {
            GUI.Label(new Rect(370, 40, 150, 20), "Rhumb Angle");
            //startRotationX = GUI.HorizontalSlider (new Rect (520, 45, 180, 20), startRotationX, 0.1f, 2f);
            startRotationX = GUI.HorizontalSlider(new Rect(520, 45, 180, 20), startRotationX, 0, 2f);
        }
        if (displayStarfishControls)
        {
            GUI.Label(new Rect(370, 40, 150, 20), "Trunk Start Rotation X");
            startRotationX = GUI.HorizontalSlider(new Rect(520, 45, 180, 20), startRotationX, 0, 360);
        }
        if (displayStarfishControls || displayRingControls)
        {
            GUI.Label(new Rect(370, 70, 150, 20), "Trunk Start Rotation Y");
            startRotationY = GUI.HorizontalSlider(new Rect(520, 75, 180, 20), startRotationY, 0, 360);

            GUI.Label(new Rect(370, 100, 150, 20), "Trunk Start Rotation Z");
            startRotationZ = GUI.HorizontalSlider(new Rect(520, 105, 180, 20), startRotationZ, 0, 360);
        }

        startRotation.x = startRotationX;
        startRotation.y = startRotationY;
        startRotation.z = startRotationZ;
        formConfig.setStartRotation(startRotation);

        //trunk position delta
        Vector3 trunkPositionDelta = formConfig.getTrunkPositionDelta();

        trunkPositionDeltaX = trunkPositionDelta.x;
        trunkPositionDeltaY = trunkPositionDelta.y;
        trunkPositionDeltaZ = trunkPositionDelta.z;

        if (displayStarfishControls || displayRingControls)
        {
            GUI.Label(new Rect(20, 130, 150, 20), "Trunk Position Delta X");
            trunkPositionDeltaX = GUI.HorizontalSlider(new Rect(180, 135, 180, 20), trunkPositionDeltaX, -1, 1);

            GUI.Label(new Rect(20, 160, 150, 20), "Trunk Position Delta Y");
            trunkPositionDeltaY = GUI.HorizontalSlider(new Rect(180, 165, 180, 20), trunkPositionDeltaY, -1, 1);

            GUI.Label(new Rect(20, 190, 150, 20), "Trunk Position Delta Z");
            trunkPositionDeltaZ = GUI.HorizontalSlider(new Rect(180, 195, 180, 20), trunkPositionDeltaZ, -1, 1);
        }

        trunkPositionDelta.x = trunkPositionDeltaX;
        trunkPositionDelta.y = trunkPositionDeltaY;
        trunkPositionDelta.z = trunkPositionDeltaZ;
        formConfig.setTrunkPositionDelta(trunkPositionDelta);

        //trunk rotation delta
        Vector3 trunkRotatiomnDelta = formConfig.getTrunkRotationDelta();

        trunkRotationDeltaX = trunkRotatiomnDelta.x;
        trunkRotationDeltaY = trunkRotatiomnDelta.y;
        trunkRotationDeltaZ = trunkRotatiomnDelta.z;

        if (displayStarfishControls)
        {
            GUI.Label(new Rect(20, 220, 150, 20), "Trunk Rotation Delta X");
            trunkRotationDeltaX = GUI.HorizontalSlider(new Rect(180, 225, 180, 20), trunkRotationDeltaX, -60, 60);
        }
        if (displayStarfishControls || displayRingControls)
        {
            GUI.Label(new Rect(20, 250, 150, 20), "Trunk Rotation Delta Y");
            trunkRotationDeltaY = GUI.HorizontalSlider(new Rect(180, 255, 180, 20), trunkRotationDeltaY, -60, 60);

            GUI.Label(new Rect(20, 280, 150, 20), "Trunk Rotation Delta Z");
            trunkRotationDeltaZ = GUI.HorizontalSlider(new Rect(180, 285, 180, 20), trunkRotationDeltaZ, -60, 60);
        }

        trunkRotatiomnDelta.x = trunkRotationDeltaX;
        trunkRotatiomnDelta.y = trunkRotationDeltaY;
        trunkRotatiomnDelta.z = trunkRotationDeltaZ;
        formConfig.setTrunkRotationDelta(trunkRotatiomnDelta);

        //trunk iterations
        trunkIterations = formConfig.getTrunkIterations();

        GUI.Label(new Rect(20, 310, 150, 20), "Trunk Iterations *");
        trunkIterations = GUI.HorizontalSlider(new Rect(180, 315, 180, 20), trunkIterations, 1, 24);

        formConfig.setTrunkIterations((int)trunkIterations);

        /* BRANCH */

        //branch position delta
        Vector3 branchPositionDelta = formConfig.getBranchPositionDelta();

        branchPositionDeltaX = branchPositionDelta.x;
        branchPositionDeltaY = branchPositionDelta.y;
        branchPositionDeltaZ = branchPositionDelta.z;

        if (displayRingControls || displayLoxodromeControls)
        {
            GUI.Label(new Rect(370, 130, 150, 20), "Radius");
            branchPositionDeltaX = GUI.HorizontalSlider(new Rect(520, 135, 180, 20), branchPositionDeltaX, 0.2f, 1);
        }
        if (displayStarfishControls)
        {
            GUI.Label(new Rect(370, 130, 150, 20), "Branch Position Delta X");
            branchPositionDeltaX = GUI.HorizontalSlider(new Rect(520, 135, 180, 20), branchPositionDeltaX, -1, 1);

            GUI.Label(new Rect(370, 160, 150, 20), "Branch Position Delta Y");
            branchPositionDeltaY = GUI.HorizontalSlider(new Rect(520, 165, 180, 20), branchPositionDeltaY, -1, 1);

            GUI.Label(new Rect(370, 190, 150, 20), "Branch Position Delta Z");
            branchPositionDeltaZ = GUI.HorizontalSlider(new Rect(520, 195, 180, 20), branchPositionDeltaZ, -1, 1);
        }

        branchPositionDelta.x = branchPositionDeltaX;
        branchPositionDelta.y = branchPositionDeltaY;
        branchPositionDelta.z = branchPositionDeltaZ;
        formConfig.setBranchPositionDelta(branchPositionDelta);

        //branch rotation delta
        Vector3 branchRotationDelta = formConfig.getBranchTwistDelta();

        branchRotationDeltaX = branchRotationDelta.x;
        branchRotationDeltaY = branchRotationDelta.y;
        branchRotationDeltaZ = branchRotationDelta.z;

        if (displayStarfishControls)
        {
            GUI.Label(new Rect(370, 220, 150, 20), "Branch Rotation Delta X");
            branchRotationDeltaX = GUI.HorizontalSlider(new Rect(520, 225, 180, 20), branchRotationDeltaX, -30, 30);

            GUI.Label(new Rect(370, 250, 150, 20), "Branch Rotation Delta Y");
            branchRotationDeltaY = GUI.HorizontalSlider(new Rect(520, 255, 180, 20), branchRotationDeltaY, -30, 30);

            GUI.Label(new Rect(370, 280, 150, 20), "Branch Rotation Delta Z");
            branchRotationDeltaZ = GUI.HorizontalSlider(new Rect(520, 285, 180, 20), branchRotationDeltaZ, -30, 30);
        }

        branchRotationDelta.x = branchRotationDeltaX;
        branchRotationDelta.y = branchRotationDeltaY;
        branchRotationDelta.z = branchRotationDeltaZ;
        formConfig.setBranchTwistDelta(branchRotationDelta);

        //branch iterations
        branchIterations = formConfig.getStackIterations();

        GUI.Label(new Rect(370, 310, 150, 20), "Branch Iterations *");
        branchIterations = GUI.HorizontalSlider(new Rect(520, 315, 180, 20), branchIterations, 1, 60);

        formConfig.setStackIterations((int)branchIterations);

        /* STACK */

        //stack start rotation
        Vector3 stackStartRotation = formConfig.getStackStartTwist();

        stackStartRotationX = stackStartRotation.x;
        stackStartRotationY = stackStartRotation.y;
        stackStartRotationZ = stackStartRotation.z;

        GUI.Label(new Rect(20, 340, 150, 20), "Stack Start Rotation X");
        stackStartRotationX = GUI.HorizontalSlider(new Rect(180, 345, 180, 20), stackStartRotationX, 0, 360);

        GUI.Label(new Rect(20, 370, 150, 20), "Stack Start Rotation Y");
        stackStartRotationY = GUI.HorizontalSlider(new Rect(180, 375, 180, 20), stackStartRotationY, 0, 360);

        GUI.Label(new Rect(20, 400, 150, 20), "Stack Start Rotation Z");
        stackStartRotationZ = GUI.HorizontalSlider(new Rect(180, 405, 180, 20), stackStartRotationZ, 0, 360);

        stackStartRotation.x = stackStartRotationX;
        stackStartRotation.y = stackStartRotationY;
        stackStartRotation.z = stackStartRotationZ;
        formConfig.setStackStartTwist(stackStartRotation);

        //stack rotation delta
        Vector3 stackRotationDelta = formConfig.getStackTwistDelta();

        stackRotationDeltaX = stackRotationDelta.x;
        stackRotationDeltaY = stackRotationDelta.y;
        stackRotationDeltaZ = stackRotationDelta.z;

        GUI.Label(new Rect(370, 340, 150, 20), "Stack Rotation Delta X");
        stackRotationDeltaX = GUI.HorizontalSlider(new Rect(520, 345, 180, 20), stackRotationDeltaX, -30, 30);

        GUI.Label(new Rect(370, 370, 150, 20), "Stack Rotation Delta Y");
        stackRotationDeltaY = GUI.HorizontalSlider(new Rect(520, 375, 180, 20), stackRotationDeltaY, -30, 30);

        GUI.Label(new Rect(370, 400, 150, 20), "Stack Rotation Delta Z");
        stackRotationDeltaZ = GUI.HorizontalSlider(new Rect(520, 405, 180, 20), stackRotationDeltaZ, -30, 30);

        stackRotationDelta.x = stackRotationDeltaX;
        stackRotationDelta.y = stackRotationDeltaY;
        stackRotationDelta.z = stackRotationDeltaZ;
        formConfig.setStackTwistDelta(stackRotationDelta);

        /* MUTATION STRENGTH */
        mutationStrength = formConfig.getMutationStrength();

        GUI.Label(new Rect(20, 430, 150, 20), "Mutation Strength");
        mutationStrength = GUI.HorizontalSlider(new Rect(180, 435, 180, 20), mutationStrength, 0.5f, 3.5f);

        formConfig.setMutationStrength(mutationStrength);

        /* SCALING */
        scaling = formConfig.getScaleDelta();

        GUI.Label(new Rect(370, 430, 150, 20), "Scaling *");
        scaling = GUI.HorizontalSlider(new Rect(520, 435, 180, 20), scaling, 0.9f, 1.1f);

        formConfig.setScaleDelta(scaling);

        /* STACK SHAPE */

        selectedShape = formConfig.getStackShapeIndex();
        selectedShape = GUI.SelectionGrid(new Rect(20, 460, 200, 60), selectedShape, shapeGridStrings, 2);
        formConfig.setStackShape(selectedShape);

        /* Form Processor */
        if (formConfig.getFormProcessor().GetType() == typeof(StarfishForm))
        {
            selectedFormProcessor = 0;
        }
        else if (formConfig.getFormProcessor().GetType() == typeof(LoxodromeForm))
        {
            selectedFormProcessor = 1;
        }
        else if (formConfig.getFormProcessor().GetType() == typeof(RingForm))
        {
            selectedFormProcessor = 2;
        }
        selectedFormProcessor = GUI.SelectionGrid(new Rect(20, 525, 200, 60), selectedFormProcessor, formProcessorStrings, 2);
        if (selectedFormProcessor == 0)
        {
            formConfig.setFormProcessor(new StarfishForm());
        }
        else if (selectedFormProcessor == 1)
        {
            formConfig.setFormProcessor(new LoxodromeForm());
        }
        else if (selectedFormProcessor == 2)
        {
            formConfig.setFormProcessor(new RingForm());
        }

        /* Configurations */

        selectedConfiguration = formConfig.getIndex();
        selectedConfiguration = GUI.SelectionGrid(new Rect(230, 460, 300, 90), selectedConfiguration, configurationGridStrings, 3);
        if (selectedConfiguration != formConfig.getIndex())
        {
            //selected configuration changed
            callback.changeSelectedFormConfig(selectedConfiguration);
        }

        /* Control buttons */

        if (GUI.Button(new Rect(540, 460, 160, 26), "Reset Config"))
        {
            formConfig.reset();
        }
        if (GUI.Button(new Rect(540, 490, 160, 26), "Create Form"))
        {
            callback.createNewBrush();
        }
        if (GUI.Button(new Rect(540, 520, 160, 26), "Clear Brush"))
        {
            callback.clearBrush();
        }

        /* Load and Save buttons */
        if (GUI.Button(new Rect(230, 560, 147, 26), "Load"))
        {
            ConfigXML.loadConfiguration(formConfig);
        }
        if (GUI.Button(new Rect(383, 560, 147, 26), "Save"))
        {
            ConfigXML.saveConfiguration(formConfig);
        }
    }